Within the rich ecosystem of Linux operating systems, command-line tools are indispensable for users and system administrators. Among these are three essential utilities used to locate and describe executable commands: which, whereis, and whatis. Though they may appear similar at a glance, each serves a distinct purpose. Understanding the minute differences between them can dramatically improve a user’s efficiency when navigating or troubleshooting in a Linux environment.
Contents
The Role of the Command Line in Linux
The Linux command line is a powerful interface that allows users to interact with the system at a much deeper level than graphical user interfaces allow. Tools like which, whereis, and whatis help users locate commands and understand what they do, especially when managing packages or debugging system behavior.

The which Command
The which command is used to show the full pathname of shell commands. It searches the user’s current environment PATH to determine the location of executables. This tool is especially useful when multiple versions of a command exist or when confirming that a command is available for execution.
Syntax:
which command-name
Example:
which python3
This might return:
/usr/bin/python3
This output means that when the user types python3, the shell is executing the binary found in /usr/bin/python3
.
Best use case: Use which when you want to find out where a command binary is located in the system based on your environment path. It’s particularly helpful for verifying which version of a command will run by default if multiple versions are installed.
The whereis Command
The whereis command provides a broader view than which. It is used to locate the binary, source, and man page files for a command. Unlike which, it does not rely solely on the user’s PATH, and instead searches a fixed set of directories.
Syntax:
whereis command-name
Example:
whereis ls
Possible output:
ls: /bin/ls /usr/share/man/man1/ls.1.gz
Here, whereis shows both the binary location and its manual page, giving a more complete picture of where command-related files are found.
Best use case: Use whereis to locate all resources related to a command — not only the executable, but associated documentation and source files, if available. It’s ideal for developers and system admins who need more context around a tool.

The whatis Command
The whatis command provides a very different functionality compared to which and whereis. Rather than locating files, it gives a one-line description of a given Linux command. This description is pulled from the manual (man) page header, allowing users to quickly get an understanding of what a command does.
Syntax:
whatis command-name
Example:
whatis grep
This could return:
grep (1) - print lines matching a pattern
Best use case: Use whatis when you want a quick summary of a command without delving into its full manual. It’s particularly helpful when encountering unfamiliar commands or while scripting and needing to verify their purpose.
Key Differences at a Glance
Here’s a quick rundown of the differences between the three commands:
- which: Shows the path to a command’s executable (searches in
$PATH
) - whereis: Locates the binary, source, and man pages for a command (searches predefined directories)
- whatis: Displays a one-line description from the command’s manual
Complementary Role in Development and Administration
Each of these tools plays a unique and complementary role. Developers often use which to verify environments, particularly in environments with multiple language versions or custom installations. System administrators frequently use whereis to ensure all components of a tool are present, especially when setting up or debugging installations.
The whatis command is more suited to new users or those working across diverse Linux environments who require clarity about unfamiliar tools. Rather than digging through lengthy man pages, whatis often provides exactly what is needed.
Limitations and Considerations
- which only checks paths listed in the current user’s
$PATH
variable. - whereis works with limited scope and may not find custom locations unless paths are added.
- whatis relies on an up-to-date manual page database. If
whatis
returns “nothing appropriate”, runningsudo mandb
might update the database.
Conclusion
Understanding the individual strengths and limitations of which, whereis, and whatis empowers Linux users to locate tools, verify environments, and understand commands more efficiently. Though their function overlaps marginally, they are far from interchangeable. Mastery of these tools not only adds to user proficiency but also forms a solid foundation for advanced Linux command-line usage.
Frequently Asked Questions (FAQ)
-
Q: Can I use which to find commands installed outside of my PATH?
A: No, which only searches directories listed in the$PATH
environment variable. For broader searches, use whereis orfind
. -
Q: Why does whatis return “nothing appropriate” for some commands?
A: This usually indicates that the manual page database is outdated. You can update it by runningsudo mandb
. -
Q: Is whereis faster or more comprehensive than find?
A: whereis is faster but searches a limited set of directories. find can be used for exhaustive searches but is generally slower. -
Q: Do these commands work in all Linux distributions?
A: Generally yes, although some minimalist or embedded distributions may not have them installed by default. -
Q: What’s the best way to learn more about a command beyond whatis?
A: Use theman command-name
to access full documentation, or tryinfo command-name
for more detailed output if available.
By choosing the right utility in the right context, Linux users will find managing systems and deciphering command-line environments to be a much more efficient task.