Fundamentals 3 min read

Master Linux: When to Use which, whereis, and whatis Commands

This guide explains the differences between the Linux commands which, whereis, and whatis, showing how each searches for executables, related files, or provides brief descriptions, and includes practical examples to help users locate and understand command-line tools efficiently.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux: When to Use which, whereis, and whatis Commands

which

The which command searches the directories listed in the PATH environment variable and returns the path of the first matching executable. Example: which python This prints the full path to the Python interpreter that would be executed when you type python in the shell.

whereis

The whereis command extends the search to standard system directories and can locate binaries, manual pages, and source files. Example: whereis python The output shows the locations of the Python binary, its man page, and any source files, making it useful for finding related resources beyond PATH.

whatis

The whatis command provides a one‑line description of a command’s purpose, pulling from the manual page’s NAME section. Example: whatis python The result is a brief summary such as “python – an interpreted, interactive, object‑oriented programming language”, which is handy for quick reference.

Understanding the differences— which for executable location, whereis for broader resource locations, and whatis for concise descriptions—helps Linux users locate and identify commands efficiently.

LinuxCommand Linewhereiswhichwhatis
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.