The type command allows to display information about the command type. It means whether a Linux command is alias to some other command, built-in shell command, etc. This tutorial shows how to get information about command using type
command in Linux.
For example, to find the type of the echo
command, run the following command:
type echo
Output:
echo is a shell builtin
The type
command also accepts multiple arguments:
type echo rm ls
Output:
echo is a shell builtin
rm is /usr/bin/rm
ls is aliased to `ls --color=auto'
Get only command type
The -t
option allows to display a single word that describes the type of the command. Available values:
No. | Command type | Example |
---|---|---|
1. | alias | type -t ls |
2. | builtin | type -t echo |
3. | file | type -t rm |
4. | function | type -t _mac_addresses |
5. | keyword | type -t while |
Get command path
The -P
option allows to determine the location of a command on the disk.
type -P echo
Output:
/usr/bin/echo
In order to get all locations that contain the command, use -a
option.
type -a echo
Output:
echo is a shell builtin
echo is /usr/bin/echo
echo is /bin/echo
Leave a Comment
Cancel reply