Name

which — stdin  stdout  - file  -- opt  --help  --version

Synopsis

which file

The which command locates an executable file in your shell’s search path. If you’ve been invoking a program by typing its name:

$ who

the which command tells you where this command is located:

$ which who
/usr/bin/who

You can even find the which program itself:

$ which which
/usr/bin/which

If several programs in your search path have the same name (for example, /usr/bin/who and /usr/local/bin/who), which reports only the first.

Get Linux Pocket Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.