Sep 22, 2023 3 min read

Whereis Command in Linux

In this tutorial we will explain whereis Command in Linux. The whereis command locates binary, source, and manual files for a command.

Whereis Command in Linux
Table of Contents

whereis is a command-line utility that locates the binary, source, and manual page files for a given command. It helps you find the location of a command's executable file, source code files, and associated documentation. The "whereis" command only searches for commands installed on the system and uses a prebuilt database, so it may not account for commands or files not indexed in that database.

In this tutorial, we will demonstrate how to use the Linux whereis command. We will also address a few FAQs on whereis Command in Linux.

How to Use the whereis Command

The syntax for whereis is as follows:

whereis [OPTIONS] FILE_NAME...

Whereis searches the binary, source, and manual files for the command specified as an argument when used without any options.

By default, whereis looks for the command's files in the environment variables hard-coded paths and directories. To find the directories that the whereis command searches for, use the -1 option.

whereis -l 1

For example, to learn more about the bash command, type the following:

whereis bash

bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz

The command for which you want information is bash:, the path to the binary file is /bin/bash, the source file is /etc/bash.bashrc, and the man page is /usr/share/man/man1/bash.1.gz.

If the command you're looking for does not exist, whereis will only print the command name.

You can also use the whereis command with multiple arguments:

whereis netcat uptime

Both netcat and uptime commands will be listed in the output:


netcat: /bin/netcat /usr/share/man/man1/netcat.1.gz
uptime: /usr/bin/uptime /usr/share/man/man1/uptime.1.gz

Use the -b option to only look for command binaries.

To find the location of the ping command, for example, type the following:

whereis -b ping

ping: /bin/ping

When only looking for the location of the command binary, use the which or type commands.

Use the -s option to search only for source files.

whereis -s command

If the source files are present, the whereis command will display their locations.

The -m option restricts the search to only man files:

whereis -m command

Use the -B option to limit the locations where whereis searches for binaries, -M for manuals, and -S for sources. Each option accepts a space-separated list of absolute paths to directories. The -f option, which indicates the beginning of the filenames, must be used to end the directory list.

For example, to look for the cp binary in the /bin directory, type:

whereis -b -B /bin -f cp

cp: /bin/cp

The -u option specifies whereis to look for unusual entries. Unusual files are those that do not have exactly one entry of each requested type (binary, manual, and source) (commands).

For example, to find all binaries in the /bin directory that lack manual pages or have more than one documentation, type:

cd /bin
whereis -m -u *

After the -f option, the wildcard character (*) denotes all files in the current working directory (/bin).

FAQs to whereis command in Linux

How do I use the "whereis" command?

To use the "whereis" command, simply type "whereis" followed by the name of the command you want to locate files for.

What files does the "whereis" command locate?

The "whereis" command locates the binary (executable), source code, and manual page files associated with a command.

Can the "whereis" command find all commands installed on my system?

No, the "whereis" command can only find commands that are installed and indexed in its database.

How can I limit the search to find only the binary file or the source file using "whereis"?

You can add options to the "whereis" command. For example, "-b" limits the search to binary files, and "-s" limits it to source files.

Can "whereis" locate multiple files associated with a command?

Yes, "whereis" can locate multiple files if they exist. It will display all the locations where the files are found.

Does the "whereis" command search in specific directories only?

The "whereis" command searches in default directories where binaries, sources, and manual pages are typically installed. It does not search user-defined directories.

Can the "whereis" command be used with scripts or aliases?

No, the "whereis" command is primarily designed to locate files associated with individual commands, not scripts or aliases.


The whereis utility is used to locate a command's binary, source, and manual files.

If you have any queries, please leave a comment below and we’ll be happy to respond to them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.