Working with Linux can feel like learning a new language. There are lots of commands. Each one has its own special job. Today, we’ll look at three that seem similar: which, whereis, and whatis. They all help you find things. But they don’t work the same way. Let’s explore what they do, when to use them, and how to remember the difference.
Meet the Trio: which, whereis, and whatis
Imagine you’re at a party trying to find someone. You might ask:
- Where is that person?
- Who is that person?
- What does that person do?
That’s kind of how these commands work!
which helps you find where an executable (a command) lives.
whereis finds multiple locations related to a command — like its binary, source code, and man pages.
whatis gives you a short description — like a one-line resume — to tell you what a command does.
Let’s Dive into “which”
Use which when you want to know the exact location of a command that will run from the terminal.
Example:
$ which ls
/bin/ls
This tells you that when you type ls
, the system is running the version found in /bin
. Simple!
When to use it:
- You want to check which version of a command is being run.
- You suspect there might be multiple versions of a tool.
- You’re debugging path issues.
Tip: which
only looks at what’s in your PATH. It won’t find commands that aren’t reachable from your PATH.
Next Up: “whereis”
Need more than just the path to the executable? whereis is your friend.
Example:
$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/share/man/man1/gcc.1.gz
This shows:
- The binary file
- The libraries
- The man page
whenis goes deeper than which. It searches more places and tells you more details.

When to use it:
- You want to find all files related to a command.
- You need man pages or config files for a tool.
- You’re doing deeper system inspection or troubleshooting.
Tip: whereis
is broader than which
. But it doesn’t show everything — it’s not as detailed as find
or locate
.
Last but Not Least: “whatis”
Ever seen a command and wondered, “What does this even do?” whatis can tell you.
It gives you a one-liner about any Linux command. It pulls this info from the man pages. Think of it like a command summary.
$ whatis mkdir
mkdir (1) - make directories
So, now you know mkdir
is for making directories.
When to use it:
- You’re new to a command.
- You forgot what a tool does and need a fast reminder.
- You want a cheat-sheet revival of command purposes.
Tip: If you get nothing back, you may need to update your database with:
$ sudo makewhatis
Quick Comparison
Let’s keep it extra simple with a side-by-side:
Command | Purpose | Good For |
---|---|---|
which |
Finds the path of an executable from your PATH | Quick checks |
whereis |
Finds binary, source, and man files | More detail, deeper system info |
whatis |
Gives a one-line manual summary | Understanding command purpose |
Real World Use Case
Let’s say you installed a tool like python
, but it’s not doing what you expect. Try this:
$ which python
/usr/bin/python
$ whereis python
python: /usr/bin/python /usr/lib/python3.10 /usr/share/man/man1/python.1.gz
$ whatis python
python (1) - an interpreted, interactive, object-oriented programming language
Now you know:
- Where your system is getting
python
from - What files are related
- What the command is supposed to do
This helps you troubleshoot version problems or know what documentation is available.

Gotchas to Keep in Mind
Here are some quick things to watch out for:
- which only refers to the first match in
$PATH
- whereis doesn’t look everywhere — just standard locations
- whatis depends on an up-to-date man database. If it returns nothing, run
makewhatis
.
Cool Tricks
Want to really look like a command line pro? Try this combo:
$ whatis $(basename $(which nano))
nano (1) - Nano's ANOther editor, an enhanced free Pico clone
This finds where nano is, pulls the name, then tells you what it does. Boom, all three concepts in one line!
Wrapping It Up
Learning Linux is like going on an adventure. You pick up cool tools along the way. Knowing which, whereis, and whatis gives you more power in the terminal.
They may sound similar, but they each shine in their own way:
- Use
which
when you’re curious where a command lives. - Use
whereis
when you want the full command package. - Use
whatis
when you want to know what something does.
It’s like being a command detective — and with these tools, you’ve got a full kit ready to go.
Happy hacking!