The type command is used to describe how its argument would be translated if used as commands. It is also used to find out whether it is built-in or external binary file.
Syntax:
type [Options] command names
Example:
Options:
-
-a : This option is used to find out whether it is an alias, keyword or a function and it also displays the path of an executable, if available.
Example:
type -a pwd
-
-t : This option will display a single word as an output.
- alias – if command is a shell alias
- keyword – if command is a shell reserved word
- builtin – if command is a shell builtin
- function – if command is a shell function
- file – if command is a disk file
Example:
type -t pwd type -t cp type -t ls type -t while
-
-p : This option displays the name of the disk file which would be executed by the shell. It will return nothing if the command is not a disk file.
Example:
type -p dash