Examples of locating commands with the which command

To find out if a command name is located in your command path:

   which ue
   /usr/local/bin/ue

This returns the information that the MicroEMACS editor (ue) is available on this system as the file /usr/local/bin/ue.


To find out if the Korn shell is available on your system:

   which ksh
   /bin/ksh

This returns the information that the Korn shell is available on your system in the directory /bin.


To find out which (if any) of several commands are available:

   which delete talk ps
   No delete in /usr/local/utils/bin:/bin:/usr/bin:
   /usr/local/ucb/bin:/usr/local/gnu/bin:
   /usr/local/public/bin:/usr/bin/X11:.
   /usr/bin/talk
   /bin/ps

This returns the information that the file for the command delete does not exist in any of the directories that are specified in this user's PATH environment variable.

Pathnames for the files of the commands talk and ps are displayed, so these commands are available on this system.


[Home] [Search] [Index] This site maintained by webmaster@deslab.mit.edu