Chapter 6. Commands for Command Management

Type, which and whereis (Display Command Information)

Type, which and whereis (Display Command Information)
Tag:

There are several Linux commands that give you information about Linux commands besides the man command.

type – displays the type of a command

The type command returns types of commands. There are largely three types.

  1. Shell built-in command (internal command)
  2. External command (shell refers to the path of a command when it executes it)
  3. Alias

Here are examples of the three types.

Command Line - INPUT
type echo
Command Line - INTERACTIVE
echo is a shell builtin
Command Line - INPUT
type find
Command Line - INTERACTIVE
find is /usr/bin/find
Command Line - INPUT
type ll
Command Line - INTERACTIVE
ll is aliased to `ls -alF'

which – displays the path of a command

The which command gives you a file path of a command.

Command Line - INPUT
which sort
Command Line - RESPONSE
/usr/bin/sort

whereis – displays path of a command and related documents of the command

The whereis command is similar to the which command but gives you more information.

Command Line - INPUT
whereis sort
Command Line - RESPONSE
sort: /usr/bin/sort /usr/share/man/man1/sort.1.gz

There are several Linux commands that give you information about Linux commands besides the man command.

type – displays the type of a command

The type command returns types of commands. There are largely three types.

  1. Shell built-in command (internal command)
  2. External command (shell refers to the path of a command when it executes it)
  3. Alias

Here are examples of the three types.

Command Line - INPUT
type echo
Command Line - INTERACTIVE
echo is a shell builtin
Command Line - INPUT
type find
Command Line - INTERACTIVE
find is /usr/bin/find
Command Line - INPUT
type ll
Command Line - INTERACTIVE
ll is aliased to `ls -alF'

which – displays the path of a command

The which command gives you a file path of a command.

Command Line - INPUT
which sort
Command Line - RESPONSE
/usr/bin/sort

whereis – displays path of a command and related documents of the command

The whereis command is similar to the which command but gives you more information.

Command Line - INPUT
whereis sort
Command Line - RESPONSE
sort: /usr/bin/sort /usr/share/man/man1/sort.1.gz
Tag: