Whereis Command in Linux: Syntax, Commands & Examples.

How to use Whereis Command in Linux?

Whereis command in Linux


hereis Command in Linux: The Whereis command is used as an utility and mainly used to find or locate the files in your Linux sytem. You can use the Whereis command to find the location of files using the following command. In this article, we added the information about Whereis command syntax, options & examples.

Jump To:

Whereis Command Syntax:

The basic syntax of the Whereis command is,

$whereis {OPTIONS} Filename

Whereis Command Options:

You can find the Whereis commands options using the following command,

$whereis --help
Whereis Command Options
Whereis Command Options

The output of the above command is,

[email protected]:~$ whereis --help

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

Locate the binary, source, and manual-page files for a command.

 -b         search only for binaries
 -B <dirs>  define binaries lookup path
 -m         search only for manuals and infos
 -M <dirs>  define man and info lookup path
 -s         search only for sources
 -S <dirs>  define sources lookup path
 -f         terminate <dirs> argument list
 -u         search for unusual entries
 -l         output effective lookup paths

 -h, --help     display this help
 -V, --version  display version

For more details see whereis(1).
[email protected]:~$ 

By default, Whereis command will locate the binary, source and manual files for the command specified as an argument if any options are not mentioned.

How to use Whereis Command:

Using -l option along with whereis command used to locate the directories where the “whereis” command searched for.

Follow the below command,

$whereis -l

The output of the above command is,

[email protected]:~$ whereis -l
bin: /usr/bin
bin: /usr/sbin
bin: /usr/lib/x86_64-linux-gnu
bin: /usr/lib
bin: /usr/lib64
bin: /etc
bin: /usr/games
bin: /usr/local/bin
bin: /usr/local/sbin
bin: /usr/local/etc
bin: /usr/local/lib
bin: /usr/local/games
bin: /usr/include
bin: /usr/local
bin: /usr/libexec
bin: /usr/share
bin: /snap/bin
man: /usr/share/man/pt
man: /usr/share/man/fr.ISO8859-1
man: /usr/share/man/it
man: /usr/share/man/pl
man: /usr/share/man/es
man: /usr/share/man/man3
man: /usr/share/man/man5
man: /usr/share/man/man6
man: /usr/share/man/sl
man: /usr/share/man/man7
man: /usr/share/man/da
man: /usr/share/man/pt_BR
man: /usr/share/man/sv
man: /usr/share/man/id
man: /usr/share/man/ja
man: /usr/share/man/tr
man: /usr/share/man/sr
man: /usr/share/man/man4
man: /usr/share/man/ru
man: /usr/share/man/man2
man: /usr/share/man/zh_TW
man: /usr/share/man/cs
man: /usr/share/man/ko
man: /usr/share/man/man8
man: /usr/share/man/fr.UTF-8
man: /usr/share/man/zh_CN
man: /usr/share/man/man1
man: /usr/share/man/nl
man: /usr/share/man/de
man: /usr/share/man/hu
man: /usr/share/man/fr
man: /usr/share/man/fi
man: /usr/share/info
src: /usr/src/linux-headers-5.3.0-18
src: /usr/src/linux-headers-5.3.0-13-generic
src: /usr/src/linux-headers-5.3.0-13
src: /usr/src/linux-headers-5.3.0-18-generic
src: /usr/src/nvidia-435.21
[email protected]:~$ 

From the above output, we come to know where the whereis command looked for the files in the directories.

Check this too  10 Interesting Usages of "!" Operator in Linux Commands

Whereis command basic example:

Use the below command to find the information about bash command:

$whereis bash

The output of the above command is,

[email protected]:~$ whereis bash
bash: /usr/bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz
[email protected]:~$ 
Whereis command Examples
Whereis command Examples

From the above output,

  • bash is command filename that we are looking for the information about
  • /bin/bash is the path to the binary file
  • /etc/bash.bashrc is the source of the file
  • /usr/share/man/man1/bash.1.gz is the main page.

Whereis command used with more than One Arguments:

Whereis command allows you to use more than one argument along with whereis command. Follow the below example,

$whereis etc bash copy

The output of the above command will print the information about etc, bash, copy commands and the output is,

[email protected]:~$ whereis etc bash copy
etc: /usr/local/etc
bash: /usr/bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz
[email protected]:~$ 
Whereis command examples
Whereis command examples

From the above output, the whereis command prints the information about the arguments of bash and etc only. The copy command does not exist in Linux and so the whereis command print no information.

Whereis command will not print any information if the command does not exist in Linux.

Whereis command with -s option:

The option -s is used to locate the source of the files. Use the below command,

$whereis -s [command]

Whereis command with -u option:

The option -u is used to printing the unusual entries in Linux.


That’s it. The above list of information about whereis command will help you understand the usage and working of whereis command in Linux. If you have any queries related to this topic and then feel free to comment us below.

Check this too  Bash:~ PIP Command Not Found in Linux! [Easy Fix]
Article Review
  • Article Explanation
  • Commands Provided
  • Examples Provided
  • Images Explanation


For more articles, Kindly visit our HomePage

Leave a Reply

Your email address will not be published. Required fields are marked *

Written by Julian

Hello Folks! I'm Julian, Promoted to the Content writer for the category of Commands & Web Apps in Tec Robust. Enjoy my content & Learn more Linux Commands!

Contact me:
tecrobust [@]
Sub: Message to Julian

How to use Web WhatsApp on Ubuntu 18.04 & 19.04 Linux

Eoan Ermine Wallpapers

Ubuntu 19.10 Wallpapers Revealed! Official & default