Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

These three commands answer different questions: which is commonly used to locate an executable, whereis searches for related binary, source, and manual files, and whatis gives a brief description from local manual-page indexes. In Bash, start with type -a name when you need to know what the shell will actually resolve, because that can include aliases, functions, and builtins—not just executable files.

Which command answers your question?

Question Command to try What it tells you
Which definition will Bash use for this name? type -a name Shows matching aliases, functions, builtins, and executable commands that Bash knows about. Bash checks functions and builtins before searching PATH for an executable. GNU Bash manual: command lookup; GNU Bash manual: type
Where might related files be installed? whereis name Looks for binary, source, and manual files in standard locations, with lookup influenced by PATH, MANPATH, and system configuration. It may not find every installed copy. whereis(1)
What does the name do, briefly? whatis name Searches local manual-page name indexes for short descriptions. Results depend on installed manual pages and index data. whatis(1)

The tools are not interchangeable. A shell can resolve a name to a function or builtin even when an executable with the same name exists elsewhere on PATH. Conversely, finding a manual page does not establish which implementation your shell will run.

Find what Bash will run

Use type for shell-aware lookup

Run type -a name to see the kinds of matches Bash reports, including multiple matches. For example, replace name with ls:

type -a ls

If you specifically need an executable-path search rather than Bash’s broader command resolution, use type -P name. The distinction matters when a function, alias, or builtin takes precedence over a program file.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where which fits

which name is commonly used to look up an executable, but its behavior depends on which which implementation is installed. It is not a dependable way to explain every shell function, alias, or builtin. For a Bash-specific answer about what the shell knows under a name, prefer type. The GNU Bash manual describes Bash’s command lookup and its type builtin: command search and execution and Bash builtins.

Find related files with whereis

Use whereis when you want to look for a command’s associated binary, source, or manual files:

  • whereis ls checks for the supported file types.
  • whereis -b ls limits the search to binaries.
  • whereis -m ls limits it to manual pages.
  • whereis -s ls limits it to source files.

Options -B, -M, and -S constrain the directories searched for binaries, manuals, and source; -f separates those directory lists from the names being checked. Use whereis -l to print effective lookup paths. These options and the search behavior are documented by util-linux’s whereis(1); exact locations depend on the installed version and environment.

Treat the output as a set of search results, not a complete inventory of every copy on the machine. A result can vary across distributions and configurations, so check the paths on your own system.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Get a short description with whatis

whatis name searches manual-page names and returns brief descriptions. For example:

whatis printf

Depending on your installed manual pages and index, the output may include a shell builtin entry and one or more manual entries. whatis consults local manual-page index data maintained by mandb; it is not an internet search and cannot describe entries absent from the local index. If an entry is missing or the database is stale, results can be incomplete. The whatis(1) manual documents -w for wildcard matching and -r for regular-expression matching; quote patterns as needed to prevent the shell from expanding them first.

For instructions beyond a one-line description, open the relevant manual page with man name. A short whatis result is a starting point, not a substitute for that page.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A practical lookup sequence

  1. Check Bash resolution: run type -a name to see what kinds of definitions Bash finds.
  2. Check for an executable path: if that is the question, use type -P name; which name is another common but implementation-dependent executable lookup.
  3. Look for associated files: run whereis name, adding -b, -m, or -s to narrow the file type.
  4. Read a brief description: run whatis name; for fuller usage information, run man name.

Replace name with the command you are investigating, and interpret the results in light of your shell, installed packages, and local manual-page configuration.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.