type how command is interpreted: command aliases

The type command is used to find out if command is builtin or external binary file. It also indicate how it would be interpreted if used as a command name.


If the -t option is used, it will print a single word which is one of the following

  • alias (command is shell alias)
  • keyword (command is shell reserved word)
  • function (command is shell function)
  • builtin (command is shell builtin)
  • file (command is disk file)

type -t Command Examples

Try the following examples:

Command Output Meaning
type -t ls alias ls command is alias which can be verified by typing the alias command itself at a shell prompt:
type -t date file date command is a disk file (external command), which can be verified by issued the which date command at a shell prompt:
which date
type -t xrpm function xrpm is a user defined function.
type -t if keyword if is a shell reserved word, which is used for flow control.
type -t pwd builtin pwd is a shell builtin command.

Return Command Name Type (-p option)

The -p option is used to find of the name of the disk file (external command) would be executed by the shell. It will return nothing if it is not a disk file.

type -p Command Examples

Type the following command at a shell prompt:

type -p ls

Nothing is return as ls is aliased on my CentOS Linux system. You can verify this by typing the following command:

type -t ls

However, the following should return full disk path to date command:

type -p date

Sample Outputs:


Find Out All Information About The Command

The -a option can be used to find out if given command is disk file, alias, keyword or function. It will display all of the places that contains an executable available including aliases, builtins, and functions.

type -a Command Examples

Type the following command at a shell prompt:

type -a pwd

Sample Outputs:

pwd is a shell builtin
pwd is /bin/pwd