Find out if a command resolves to an alias, a disk file, a shell function, a built-in command, or a reserved word. Use type
to discover how your Linux commands are executed and understand your system better.
Do My Bidding
When we open a terminal window and start issuing commands to our Linux computer, we rarely stop to think what software components within the operating system are reacting to our commands and carrying them out for us. We type the command, get the result, and move on with our workload.
Knowing how the commands are carried out gives us a better understanding of the way our Linux or other Unix-like operating system is constructed. Having a peek beneath the hood can make us a more informed driver.
The instructions we issue to the command line are in one of the following categories:
- Alias: A user (or system) defined command that causes other, usually long-winded or complex, command sequences to take place.
- Disk file: A binary executable file, such as
/usr/bin/top
. - Shell function: A user (or system) defined function that can be used on the command line or included in scripts.
- Builtin command: A command that is carried out by the shell itself, such as
pwd
. - Reserved word: A word that is reserved by the shell such as
if
andelif
. They are also called keywords.
The type
command tells us which category any of the Linux commands belongs to. Here’s a quick tutorial to understanding the command’s output.
The type Command
Let’s rattle through some quick examples, for each of the command categories.
type date
The date
command is an executable disk file.
type ls
Read the remaining 26 paragraphs
Source : How to Use the Linux type Command