This command searches for files that meet the conditions in a specific directory. These files should belong to the original code, binary files, or help files.
This command can only be used to find binary files, source code files, and man manual pages. Generally, the locate command is used to locate files.
Syntax
Whereis [-bfmsu] [-B <Directory>...] [-M <Directory>...] [-S <Directory>...] [File...]
Parameters:
-B only searches for binary files.
-B <Directory> searches for binary files only in the set directory.
-F does not display the path name before the file name.
-M: only find the description file.
-M <Directory> searches for description files only in the specified directory.
-S only searches for original code files.
-S <Directory> only searches for original code files in the set directory.
-U searches for files that do not contain the specified type.
Instance
Run the following command to view the location of the command bash:
$ Whereis bash
After the preceding command is executed, the output information is as follows:
Bash:/bin/bash/etc/bash. bashrc/usr/share/man/man1/bash.1.gz
Note: The above output information is the queried program name, bash path, and bash man manual page path from left to right.
To query binary or help files separately, run the following command:
$ Whereis-B bash
$ Whereis-m bash
The output information is as follows:
$ Whereis-B bash # display the binary program of the bash command
Bash:/bin/bash/etc/bash. bashrc/usr/share/bash # address of the bash command binary program
$ Whereis-m bash # display the help file of the bash command
Bash:/usr/share/man/man1/bash.1.gz # bash command help file address