Linux: which vs whereis command

Linux: which vs. whereis

which command – shows the full path of (shell) commands.


[[email protected] ~]$ which pwd

whereis command – locate the binary, source, and manual page files for a command.


[[email protected] ~]$ whereis pwd
pwd: /usr/bin/pwd /usr/share/man/man1/pwd.1.gz /usr/share/man/man1p/pwd.1p.gz

whereis searches for “possibly useful” files, while which only searches for executables.

So if you do not find an executable with one of the two commands, you should give the other one a try.

Related commands

find — Find files within a directory hierarchy.

Add Comment