Linux Command: whereis
Locate the binary, source, and manual page files for a command
The whereis command locates binary, source, and manual page files for a command. Unlike which (which only searches PATH), whereis searches standard system directories for all components of a program. whereis looks in directories like /usr/bin, /usr/sbin, /usr/share/man, and other standard locations. It finds not just the executable but also documentation and source files. This command is useful for finding all installed components of a program, locating man pages, and discovering if source code is available on the system.
Syntax
whereis [OPTION] NAMEKey Options
-bโ Search only for binaries-mโ Search only for man pages-sโ Search only for source files-uโ Find commands with unusual (missing) entries-Bโ Define binary search path-lโ List directories that will be searched
Examples
Find all components
whereis nginxOutput: nginx: /usr/sbin/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz
Find binary only
whereis -b python3Output: python3: /usr/bin/python3
Find man pages
whereis -m awkOutput: awk: /usr/share/man/man1/awk.1.gz
Pro Tips
- which searches PATH and finds only executables. whereis searches standard directories and finds binaries, man pages, and source files.
- Use whereis -m command to quickly check if man pages exist for a command before trying to read them.
- whereis only searches standard system directories. It may miss programs installed in non-standard locations like /opt or ~/.local/bin.
Learn more: Full whereis reference โ