whereis Command Cheat Sheet
whereis locates the binary, source, and manual page files for a command.
Synopsis
whereis [options] filename
Basic Usage
Find bash locations.
whereis bash
# Output: bash: /usr/bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz
Specific Searches
Binary Only (-b)
whereis -b bash
# Output: bash: /usr/bin/bash /etc/bash.bashrc
Manual Pages Only (-m)
whereis -m bash
# Output: bash: /usr/share/man/man1/bash.1.gz
Source Code Only (-s)
whereis -s bash
Comparison
| Command | Searches In | Accuracy | Speed |
|---|---|---|---|
whereis |
Standard install paths | Good for system tools | Fast |
which |
$PATH only |
Finds what runs | Fast |
locate |
Database (mlocate) | Finds everything | Very Fast |
find |
Live filesystem | Accurate but slow | Slow |
Notes
- Directories: It searches a hard-coded list of standard Linux paths (
/bin,/usr/bin,/usr/share/man, etc.). It will not find user scripts in~/bin.