type – Displays the type of the specified command

The type command is used to display the type of the specified command. This command is helpful when you want to know whether a command is a shell built-in, an alias, a function, or an executable file.

Overview

The syntax for the type command is as follows:

type [OPTIONS] [COMMAND]

Where OPTIONS are the various options available for the type command and COMMAND is the name of the command whose type you want to display.

For example, to display the type of the ls command, you would run the following command:

$ type ls
ls is aliased to `ls --color=auto'

This output tells you that ls is an alias for the ls --color=auto command.

Another example would be to display the type of the cd command:

$ type cd
cd is a shell builtin

This output tells you that cd is a shell built-in command.

Options

The type command has a few options that you can use to modify its behavior. The available options are:

Option Description
-a Displays all locations of the specified command.
-t Displays the type of the specified command.
--help Displays the help message for the type command.
--version Displays the version information for the type command.

Troubleshooting Tips

If you receive an error message that says “command not found” when running the type command, it means that the specified command does not exist or is not in your system’s PATH.

If you are not sure whether a command is a shell built-in, an alias, a function, or an executable file, you can use the type command to find out.

Notes

  • The type command is a shell built-in command, which means that it is executed within the shell itself and not as a separate executable file.
  • The type command is available in most Linux distributions and Unix-like operating systems.