Which command
From NetworkCommands
A command line programs available on Linux platforms; used to display the full path of commands or programs. In other words, the which command is used to display where programs or executables reside on a system.
Contents |
Usage Syntax
which [options] command/program-name
A common option is;
- -a - print all matching executables found in the system path, not just the first
Other options are rather complex and not suitable for the audience of this article.
Usage Examples
which bash - display the full path of the bash shell executable
Usage Notes
Commands and programs which do not reside somewhere in the system path will obviously not be found or displayed.
The system path can be displayed with the set command
Linux Usage Notes
With most Linux or Unix commands;
- Brief help can be displayed using the option/keyword: -h or --help, for example: chmod --help
- A full command manual can be displayed using the man command followed by the command name, for example: man chmod
- Sometimes 'info' pages are used instead of or to provide more information than man pages; for example: info chmod
- Version information can be display using the option/keyword: -v or --version, for example: chmod --version
Typical Output
which bash - an example of when a command is found;
/bin/bash
which nothing - an example of when a command is not found in the system path;
/usr/bin/which: no nothing in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/siveson/bin)
Related Commands
The system path can be displayed with the set command
Related Articles
Information on other Linux commands
Information on Cisco commands
Information on Vyatta commands
Information on Extreme commands
Information on F5 BigIP commands
Information on Blue Coat SGOS commands
Information on Nokia IPSO commands








