How to use the Linux command

Find out if a command resolves to an alias, disk file, shell function, built-in command, or reserved word. Use type to find out how your Linux commands are executed and to better understand your system.


When we open a terminal window and issue commands to our Linux computer, we seldom think about which software components within the operating system respond to our commands and execute them for us. We enter the command, get the result, and move on with our workload.

If we know how the commands are executed, we can better understand how our Linux or other Unix-like operating system is structured. A look under the hood can make us a more informed driver.

The instructions we issue on the command line fall into one of the following categories:

  • Alias: A user (or system) defined command that causes other, usually lengthy or complex command sequences.
  • Hard disk file: A binary executable file such as /usr/bin/top.
  • Shell Function: A user-defined (or system-) defined function that can be used on the command line or included in scripts.
  • Builtin Command: A command that is executed by the shell itself, such as pwd.
  • Reserved Word: A word reserved by the shell, such as if and elif. They are also called keywords.

the type command tells us which category none of the Linux commands belongs to. Here is a quick tutorial to understand the output of the command.

The type Command

Let’s go through a few brief examples for each of the command categories.

type date

the date Command is an executable disk file.

type ls

the ls Command is an alias that encloses the base value ls Command to use that --color=auto Option by default.

type lowdown

the lowdown Command is a custom function set up on the commuter used to research this article. It provides a quick snapshot of some system resources. It’s a combination of whoami , w , free and df .

type pwd

the pwd Command is a built-in command in the bash shell.

type elif

the elif Command is a reserved word in the bash shell.

Use multiple commands

You can give type identify multiple commands at the same time.

type date top ls

The -t option

None of the options that type have accepted names. So we can get out our name book and baptize it ourselves. When you think of them -t If this option stands for “short,” you won’t go too far wrong. It reduces the responses from type to single word answers.

type -t date
type -t pwd
type -t lowdown

The -a option

Let’s call this the “all” option. It lists all of the locations where the command is located. Note that if you also have the -p Opportunity.

To the exampleif you have an alias with the same name as the underlying command, you can get information about the alias and command.

type -a ls

The -f option

the -f Option forces type so as not to search for user-defined or system-defined functions. Think of this option as “Feature Finder Off”. Note that if the command is a function, type reports that the command cannot be found.

type -f top
type -f lowdown

The -P option

If you use that -P Opportunity, type just going to look the directories in $ PATH. So we can call this option “path”. Note that this option uses a capital “P”.

type -P date chmod adduser

The -p option

If you use that -p Opportunity, type only responds if the command is a disk file. Note that this option uses a lowercase “p”.

type -p mount
type -p ls
type -p -a ls

Demonstration of the type -p option in a terminal widow

type gives no answer for ls there ls an alias and not a disk file.

But if we include them -a Option with it type searches for all instances of ls Command, it lists the underlying disk file that the ls alias used.


That was nice and simple, but enlightening nonetheless.

We tend to think of anything we type in a terminal window as a “command,” and we leave it at that. But, in fact, commands are implemented in different ways in the Linux system. and type lets you find out which one it is.

Linux commands
Filestar · pv · cat · tac · chmod · grep · difference · sed · With · man · pushed · popd · fsck · Test disk · seq · fd · pandoc · CD · $ PATH · awk · join · jq · wrinkles · unique · Journalctl · tail · stat · ls · fstab · echo · fewer · chgrp · chown · rev · look · Strings · Type · rename · Postal code · unzip · assemble · ummount · To install · fdisk · mkfs · rm · rmdir · rsync · df · gpg · weather · Nano · mkdir · from · ln · Patch · Convert · rclon · Scraps · srm
Processesalias · screen · above · kind · renice · progress · strace · system · tmux · chsh · story · at · Batch · for free · which · dmesg · chfn · User mod · ps · chroot · xargs · tty · pinkie finger · lsof · vmstat · Time out · Wall · Yes sir · kill · sleep · sudo · it is · Time · groupadd · User mod · groups · lshw · switch off · start anew · Stop · switch off · passwd · lscpu · crontab · date · bg · fg
Networkingnetstat · Ring · Trace route · ip · ss · who is · fail2ban · bmon · she · finger · nmap · ftp · curl · wget · who · who am I · w · iptables · ssh-keygen · ufw

Best Linux Laptops for Developers and Enthusiasts

Related Posts