Read in 3 minutes

last updated 

Linux Type Command

In this tutorial, we will cover the Linux type command.

The type command is used to display information about the command type. It will show you how the command would be interpreted if typed on the command line.

How to Use the type Command

type is a shell builtin in Bash and other shells like Zsh and Ksh. Its behavior may be slightly different from shell to shell. In this article we will cover the Bash builtin version of type.

The syntax for the type command is as follows:


For example, to find the type of the wc command, you would type the following:

type wc

The output will be something like this:

wc is /usr/bin/wc

You can also provide more than one arguments to the type command:

type sleep head

The output will include information about both sleep and head commands:

sleep is /bin/sleep
head is /usr/bin/head

Command Types

The option -t tells type to print a single word describing the type of the command which can be one of the following:

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

Here are a few examples:

  1. Alias

    type -t grep

    In my system grep is aliased to grep --color=auto:

  2. Function

    type -t rvm

    rvm is a tool (function) for installing, managing and working with multiple Ruby environments:

  3. Builtin

    type -t echo

    echo is a shell builtin in Bash and other shells like Zsh and Ksh:

  4. File

    type -t cut

    cut is an executable file :

  5. Keyword

    type -t for

    for is a reserved word in Bash:


Display all locations that contain the command

To print all matches, use the -a option:

type -a pwd

The output will show you that pwd is a shell builtin but it is also available as a standalone /bin/pwd executable:

pwd is a shell builtin
pwd is /bin/pwd

When -a option is used, the type command will include aliases and functions, only if the -p option is not used.

Other type command options

The -p option will force type to return the path to the command only if the command is an executable file on the disk:

For example, the following command will not display any output because the pwd command is a shell builtin.

type -p pwd

Unlike -p, the uppercase -P option tells type to search the PATH for an executable file on the disk even if the command is not file.

type -P pwd
pwd is /bin/pwd

When the -f option is used, type will not look up for shell functions, as with the command builtin.


The type command will show you how a specific command will be interpreted if used on the command line.