Log in Go to the main page Page Discussion History Go to the file list Go to the site toolbox

Which command

From NetworkCommands


Image:Tux_64x64.png Image:F5-logo-large.png

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

Image:Vm-power-on-medium.png 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.

Image:Vm-power-on-medium.png Usage Examples

which bash - display the full path of the bash shell executable

Image:accessories-text-editor-v2-medium.png 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

Image:accessories-text-editor-v2-medium.png 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


Image:utilities-terminal-medium.png 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)

Image:icemon-medium.png Related Commands

The system path can be displayed with the set command

Image:icemon-medium.png Related Articles

Information on other Linux commands Image:Tux-small.png

Information on Cisco commands Image:Cisco-logo-small.png

Information on Vyatta commands Image:Vyatta-logo-small.png

Information on Extreme commands Image:Extreme-logo-small.png

Information on F5 BigIP commands Image:F5-logo-small.png

Information on Blue Coat SGOS commands

Information on Nokia IPSO commands


Image:internet-group-chat-small.png We really do appreciate all feedback so please do send your comments, suggestions or corrections to steve#networkstuff.eu (replacing the # with an @)



Site Toolbox:

Personal tools
This page was last modified on 10 August 2008, at 14:19. - This page has been accessed 38 times. - Disclaimers - About NetworkCommands
Powered by MediaWiki