No man-page or info-page for type command
If you enter type type
you find that
type is a shell builtin
So its documentation is in man bash
. You can't get the instructions from man type
but you can instead get them from (many thanks to @Rinzwind ) help type
and in the same format as a man page with the -m
option and by piping the output into less
help -m type | less
man bash
is very long, and may be easier to read here, specifically the section on bash builtin commands.
Here is the entry for type
, which tells us what kind of command a command is:
type
type [-afptP] [name …]
For each name, indicate how it would be interpreted if used as a command name. If the -t option is used, type prints a single word which is one of >‘alias’, ‘function’, ‘builtin’, ‘file’ or ‘keyword’, if name is an alias, shell function, shell builtin, disk file, or shell reserved word, respectively. If the name is not found, then nothing is printed, and type returns a failure status.
If the -p option is used, type either returns the name of the disk file that would be executed, or nothing if -t would not return ‘file’.
The -P option forces a path search for each name, even if -t would not return ‘file’.
If a command is hashed, -p and -P print the hashed value, which is not necessarily the file that appears first in $PATH.
If the -a option is used, type returns all of the places that contain an executable named file. This includes aliases and functions, if and only if the -p option is not also used.
If the -f option is used, type does not attempt to find shell functions, as with the command builtin.
The return status is zero if all of the names are found, non-zero if any are not found.
Examples:
$ type echo
echo is a shell builtin
$ type ls
ls is aliased to `ls --color=auto'
$ type sort
sort is /usr/bin/sort
$ type python
python is hashed (/usr/bin/python)
This answer gives a really clever way to make the man
command work for shell builtin commands by adding a function to your ~/.bashrc