Easy Tutorial
❮ Linux Comm Getty Linux Comm Fgrep ❯

Linux whereis Command

Linux Command Manual

The Linux whereis command is used to locate files.

This command searches specific directories for files that match the criteria. These files should be source code, binary files, or help files.

This command is only used to find binary files, source code files, and man pages. For locating general files, the locate command should be used.

Syntax

whereis [-bfmsu][-B <directories>...][-M <directories>...][-S <directories>...][files...]

Parameters:

-

Example

To view the location of the "bash" command using the "whereis" command, enter the following command:

$ whereis bash

The output information after executing the above command is as follows:

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

Note: The output information from left to right includes the queried program name, bash path, and bash man page path.

If the user needs to query binary files or help files separately, use the following commands:

$ whereis -b bash 
$ whereis -m bash

The output information is as follows:

$ whereis -b bash               # Displays the binary program of the bash command  
bash: /bin/bash /etc/bash.bashrc /usr/share/bash    # Address of the binary program of the bash command  
$ whereis -m bash               # Displays the help file of the bash command  
bash: /usr/share/man/man1/bash.1.gz  # Address of the help file of the bash command

Linux Command Manual

❮ Linux Comm Getty Linux Comm Fgrep ❯