*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> which (1)              



NAME    [Toc]    [Back]

     which - locate a program file (or files) in the path

SYNOPSIS    [Toc]    [Back]

     which [-a] name [...]

DESCRIPTION    [Toc]    [Back]

     which takes a list of names and looks for  the  files  which
would be executed
 had these names been given as commands.  Each argument
is searched
     for along the user's path.

     If the -a flag is given, which will return  a  list  of  all
matches instead
     of just the first match.

     The which utility exits with one of the following values:

     0     All names were successfully resolved.
     1     Some names were resolved but not all.
     2     No names were resolved.
     -1    A system error occurred.

ENVIRONMENT    [Toc]    [Back]

     The  following environment variables affect the execution of

     PATH  A colon-separated list of directories in which to find
           If  PATH is not set, and the given name is not a fully
qualified or
           relative pathname, which will fail.

DIAGNOSTICS    [Toc]    [Back]

     A diagnostic is given if an executable file with  the  argument name was
     not found in the path.

SEE ALSO    [Toc]    [Back]

     csh(1), find(1), locate(1), sh(1), whereis(1), environ(7)

HISTORY    [Toc]    [Back]

     A which command appeared in 3.0BSD.

CAVEATS    [Toc]    [Back]

     The which command formerly was a csh(1) script and could expand aliases.
     csh(1) now has a built-in which command so this  version  is
intended for
     use with other shells like sh(1).

OpenBSD      3.6                        February     21,     1997
[ Back ]
 Similar pages
Name OS Title
which FreeBSD locate a program file in the user's path
which IRIX locate a program file including aliases and path (csh only)
which HP-UX locate a program file including aliases and paths
whereis IRIX locate source, binary, and or manual for program
whereis HP-UX locate source, binary, and/or manual for program
ckconfig HP-UX verify the path names of all the FTP configuration files.
whereis Linux locate the binary, source, and manual page files for a command
SSL_CTX_set_def_verify_paths Tru64 Sets default file path and file name of trusted CA certificate
devnm HP-UX map device ID to file path
tag2name Tru64 Display the path name of an AdvFS file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service