Get Information About Command Using type Command in Linux

Get Information About Command Using type Command in Linux

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 typeExample
1.aliastype -t ls
2.builtintype -t echo
3.filetype -t rm
4.functiontype -t _mac_addresses
5.keywordtype -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

Your email address will not be published.