Find out if a command converts to an alias, a disk file, a shell function, a builtin command, or a reserved word. Use
type to learn how your Linux commands are executed and better understand your system.
Make my trades
When we open a terminal window and start issuing commands to our Linux computer, we rarely stop to consider what software components in the operating system are responding to our commands and executing them for us. We recruit a team, get a result, and move on to our workload.
Knowing how commands are executed gives us a better understanding of how our Linux or other Unix-like operating system works. Looking under the hood can make us a more informed driver.
The instructions we issue for the command line fall into one of the following categories:
- Nickname : A user (or system) defined command that causes other, usually long or complex, sequences of commands to be executed.
- Disk file : a binary executable such as
- shell function : A user (or system) defined function that can be used on the command line or included in scripts.
- built-in team : command executed by the shell itself, e.g.
- reserved word : a word reserved by the shell, e.g.
elif. They are also called keywords.
type tells us which category any of the Linux commands belongs to. Here is a quick guide to understanding the output of the command.
Let’s look at a few quick examples for each of the command categories.
date is an executable file on disk.
ls is an alias containing the base command
ls to use the parameter
lowdown is a custom feature that was configured on the commuter area used for this article’s research. This provides a quick snapshot of some system resources. It’s a combination
pwd is a built-in command of the Bash shell.