whereis — Locate command files
Linux / Basic Linux commands / whereis.html
Locates the binary, source and manual page of a command.
Basic Information
| Command Name | whereis |
|---|---|
| One-line Introduction | Locates the binary, source and manual page of a command. |
| Provided by | util-linux |
| Official Documentation | https://man7.org/linux/man-pages/man1/whereis.1.html |
| Supported Operating Systems | Linux, macOS, BSD |
| Installation Status | Installed by default |
| Category | Linux basic commands (tags: Linux basic commands (tags: whereis, location, which, man)) |
What is this command?
whereis looks in standard directories and reports the binary, source and manual page of a command. Unlike which, it does not walk the whole PATH.
Output is grouped into binary, source and manual; -b, -m and -s filter by type. It cannot see shell aliases or functions, so use type when the actual resolution matters.
What problems does it solve?
- Checking where a command binary lives
- Finding the manual page file
- Inspecting files provided by a package
- An alternative when which returns nothing
Key features
Output by type
Shows binary, source and manual separately.
- When to use: Understanding a package layout
- What you get: You see all three locations at once.
- Limitations: Missing categories are simply omitted.
Type filter
-b, -m and -s restrict the output.
- When to use: When only the binary path matters
- What you get: Output becomes concise.
- Limitations: A wrong filter yields no output.
PATH independence
Searches standard paths regardless of PATH.
- When to use: When a script needs the real file path
- What you get: Results are independent of environment variables.
- Limitations: Tools in non-standard paths are missed.
Installation and usage
Check whether it is installed
whereis --version
sudo apt install util-linux # Debian/Ubuntu sudo dnf install util-linux # Fedora
Real-world examples
All information
Show binary and manual locations.
whereis ls
Binary only
Show only the executable.
whereis -b python3
Manual only
Show only the manual page.
whereis -m grep