type Command : Display Information About Command Type On Linux

In this post we are explaining about type command with examples. In Linux system, type command is used for displaying information about command types. It displays if command is an alias,shell function, shell builtin, disk file, or shell reserved word.

You can use type command with other command names also.

With the help of type command you can also identify about command if it is Internal or External command.

Note: The type command will show output only when the command/executable name is available or installed in Linux System.


type [-afptP] name [name ...]

Try the type command without giving any argument and try to see the result. For example let’s try on cd command

user1@server01:~$ type cd
cd is a shell builtin

As per the output in above section, it confirms the cd command is Internal command (or in other words, shell builtin command)

Description Of type Command

-t option :
It will show a single word or string.It tells a command or name is an alias, shell reserved word, function, builtin, or disk file(external command).
In case command is not found, nothing will be printed as output.When we check exit status of command, it will be false.

Example :

root@tuxworld:~# type -t ls
root@tuxworld:~# type -t date
root@tuxworld:~# type -t declare
root@tuxworld:~# type -t rvm

-p option :
The command of the disk file that would be executed. In other words, absolute path of command.


root@tuxworld:~# type -p date

-P option :
Force a PATH search for each command/NAME, even if it is an alias,builtin, or function, and returns the name of the disk file that would be executed.
(We can get PATH environment value by using command echo $PATH)

NOTE: In below example, date command was searched in all directories listed in PATH(Environment set). And found the date command in /bin

root@tuxworld:~# type -P date
root@tuxworld:~# echo $PATH

-a option :
It display all locations have command or NAME .
It includes aliases, builtins, and functions (only in case , if -p option is not used )

Example :

root@tuxworld:~# type -a echo
echo is a shell builtin
echo is /usr/sbin/echo
echo is /bin/echo

-f option :
The -f option,suppress shell function lookup.


type -f rvm

Note: rvm command is a user defined function.(what is rvm? Read More) When we use type -a rvm,the output will show functions defined. In above example, -f option will suppress the function.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.