[Previous] [Contents] [Index] [Next]

which

Locate a program file (UNIX)

Syntax:

which [-afLl] program...

Options:

-a
Find all occurrences of program in PATH.
-f
Display the full pathname.
-L
Display the long format (as in ls -l) for each program found, displaying link information if the file is a symlink.
-l
("el") Display the long format (as in ls -l) for each program found.

Description:

The which utility searches the filesystem for each program specified. The user's PATH environment variable is used as the search path.

Examples:

Display the full pathname (including the node) and long status for all versions of the ls utility found in PATH:

which -alf ls

Display the pathname for the which utility:

which which

Environment variables:

PATH
A colon-separated list of directories to search for executables.

Exit status:

0
All input files were found.
>0
An error occurred.

See also:

ls, whence (builtin ksh command)


[Previous] [Contents] [Index] [Next]