Search anything:

whereis command in Linux

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

In this article we discuss the whereis command in Linux useful for locating binary files, source file and manual pages of specified commands.

Table of contents.

  1. Introduction.
  2. Syntax.
  3. Commands.
  4. Summary.
  5. References.


whereis command is a Linux command used for finding the location of binary, source files and the manual pages for a given command.

A binary is another name for an executable, source files will hold the source code for a command and manuals are the documentation of a command.


The syntax is as follows,

whereis [options] [-BMS <dir>... -f] <name>

Commonly used options include,

  • -b, to search only for binary files.
  • -s, to search only for sources.
  • -m, to search only for manuals and infos.
  • -u, to search for unusual entries.
  • -B, define binaries lookup path.
  • -S, define sources lookup path.
  • -M, define man and info lookup paths.
  • -l, to output effective lookup paths.
  • -f, to terminate a directory's argument list


To find all directories storing ping binary, source files and manual or info pages, we write,

whereis ping

The output,

ping: /usr/bin/ping /usr/share/man/man8/ping.8.gz

From the above we see that paths where the binary file and manual for ping is stored.

To locate the binary file for ping command we write,

whereis -b ping

To find the source file of a command we write,

whereis -s ls

and if the source file exists, its path will be printed as output.

To locate the manual page of a command we write

whereis -m ls

We can also search for a command's binary file in a directory as follows,

whereis -b -B /bin -f chmod

To list all paths that are used by whereis we use the -l option,

whereis -l


whereis locates the binary files, source files and manual pages for any given command in linux.

After we locate the binaries for a specific command we may be curious to know their contents, trying to concatenate i.e cat /usr/bin/ping will produce output that cannot be read. We can obtain readable strings from binaries by using the strings command which we have discussed in another article. The link is given below.


  1. Execute man whereis or whereis -h or whereis --help*
  2. which command
whereis command in Linux
Share this