Linux whereis Command: Locate Binaries, Source, and Man Pages
The whereis command locates binaries, source files, and manual pages associated with a program name. Unlike which, which focuses on PATH executables, whereis can report several related file types in one query.
This guide explains the basic syntax, key options, practical examples, related commands, common cautions, and frequently asked questions for whereis.
What Is the whereis Command?
The util-linux implementation builds its lookup locations from known system paths and environment information. It does not recursively scan the entire filesystem, so custom installation trees and arbitrary user directories may be absent unless the search paths are overridden.
Basic Syntax
whereis [OPTION]... NAME...
Options and edge cases can vary by implementation and version. Check whereis --help and man whereis on the target system before relying on implementation-specific behavior.
Basic whereis Usage
Find all related locations
The output can include binary and manual paths on one line.
whereis bash
Search only for binaries
Use -b to restrict the selected file type.
whereis -b ssh
Search only for manuals
Use -m to locate manual-page files.
whereis -m printf
Distinguishing Between Binary and Manual Locations
whereis searches for standard locations of executable files, manuals, and related items by name. It does not recursively search the entire disk.
whereis ls
Example output (installation paths vary depending on the environment):
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
The first path is the executable file, and the latter path is the manual file. If you want to know the executable path that the current shell actually selects, use type or command -v.
Key Options
| Option | Purpose |
|---|---|
-b |
Search for binaries. |
-m |
Search for manual pages. |
-s |
Search for source files. |
-B DIRS -f |
Set binary search directories. |
-M DIRS -f |
Set manual search directories. |
-S DIRS -f |
Set source search directories. |
-u |
Report unusual entries for the selected search types. |
-l |
List effective lookup paths. |
Practical Examples
List effective search paths
Use this first when a result is missing or unexpected.
whereis -l
Use custom binary paths
The -f marker terminates the directory list and begins the program names.
whereis -B /usr/local/bin /opt/tools/bin -f mytool
Compare shell resolution and related files
Check what the shell executes separately from where related files are stored.
command -v python3 whereis python3
whereis and Related Commands
| Command | Primary role | Best fit |
|---|---|---|
whereis |
Search known related-file locations | Binaries, source, and manuals |
which |
Search PATH executables | External command path |
type |
Classify shell command forms | Aliases, functions, and builtins |
find |
Walk arbitrary paths | Custom locations and complex tests |
Important Cautions
It is not a full-disk search
Files outside the effective search paths can be omitted.
Pass program names rather than arbitrary paths
Leading path components and recognized suffixes are handled according to the implementation's name rules.
Remember -f after custom path lists
Without the separator, directory and program-name operands can be interpreted differently than intended.
FAQ
Does whereis search only PATH?
No. It uses standard binary, source, and manual locations as well as relevant environment paths.
Why is a custom installation missing?
Its directory may not be in the effective search set. List or override the lookup paths.
How do I see the search paths?
The util-linux version supports whereis -l.
How do I search the whole filesystem?
Use find for a live traversal or locate for an indexed name search.









