Search
The whereis command
Looks up the binary, source code and manual pages of a program in the standard system paths. It is faster than find because it does not scan the whole disk. It is useful to quickly check whether a program is installed and where.
Most useful options
-bSearches only binaries and executables-mSearches only manual pages-sSearches only source code-B RUTA... -fAdds paths where to look for binaries. The path list ends with -f. There are -M and -S for manuals and sourcesCopy-ready examples
$ whereis lsshows the binary and the manual page of ls. The paths are separated by spaces.Example output
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
$ whereis -b gcconly the gcc executable, without the manual.Example output
gcc: /usr/bin/gcc
$ whereis -m gitonly the git manual page, useful to know whether it is installed.Example output
git: /usr/share/man/man1/git.1.gz
You can try them in the browser terminal: it does not touch your computer.
Common errors
| Message | Cause | Fix |
|---|---|---|
| No error message | It finds nothing. It returns only the name followed by a colon, with no paths. | Use which or type, or search with find in the folders you care about. |
| No error message | It only looks in standard paths. A program in /opt or in your home folder does not appear unless you give the path. | Add the path with -B, or use which if the program is in PATH. |
| bash: whereis: command not found | The command is not installed. It usually comes with the util-linux package. | Install it with your distribution package manager. |
Typical mistakes
- It only finds programs installed in standard paths. A binary copied by hand into another folder does not show up.
- It can show several paths and does not say which one runs first. Use which or type for that.
- If several versions are installed, it shows all of them with no order of preference.
Differences from similar commands
FAQ
What is the difference between whereis and which?
which searches only PATH and returns the one that would run. whereis also searches manuals and sources in fixed paths.
Why doesn't whereis find my program?
Because it is outside the standard paths. Add its folder with -B, ending the list with -f, or type the full path.
How do I search only the manual of a command?
With whereis -m name, which shows only the paths of the manual pages.
More Search commands
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course