", and "-f". , "-m", "-M", "-s", "-S", "-u"."/> ", and "-f". , "-m", "-M", "-s", "-S", "-u".">

Home  >  Article  >  Operation and Maintenance  >  How to use whereis command in Linux?

How to use whereis command in Linux?

Guanhui
GuanhuiOriginal
2020-06-28 15:28:363964browse

The whereis command in Linux will search for files that meet the conditions in a specific directory. Its syntax is "whereis [-bfmsu]", and its optional parameters include "-b" and "-Be292f350727ed3a932fb69e50ef42d1d", "-s", "-S6f655ecf17a4459bb2d05758ed836e3d", "-u".

How to use whereis command in Linux?

The Linux whereis command is used to find files.

This command will search for files that meet the conditions in a specific directory. These files should be raw code, binary files, or help files.

This command can only be used to find binary files, source code files and man pages. Generally, you need to use the locate command to locate files.

whereis Syntax

whereis [-bfmsu][-B <目录>...][-M <目录>...][-S <目录>...][文件...]

whereis Parameter

-b Only search binary files.

-B7b799fe73e35dcfdc019b13f54de80e5 Only searches for binary files in the set directory.

-f Does not display the path name before the file name.

-m Only search documentation.

-M7b799fe73e35dcfdc019b13f54de80e5 Only search for description files in the set directory.

-s Only search original code files.

-S7b799fe73e35dcfdc019b13f54de80e5 Only search the original code files in the set directory.

-u Find files that do not contain the specified type.

whereis Example

Use the command "whereis" to view the location of the command "bash", enter the following command:

$ whereis bash

After the above 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 from left to right is the queried program name, bash path, and bash man manual page path.

If the user needs to query the binary file or help file separately, the following command can be used:

$ whereis -b bash 
$ whereis -m bash

The output information is as follows:

$ whereis -b bash               #显示bash 命令的二进制程序  
bash: /bin/bash /etc/bash.bashrc /usr/share/bash    # bash命令的二进制程序的地址  
$ whereis -m bash               #显示bash 命令的帮助文件  
bash: /usr/share/man/man1/bash.1.gz  #bash命令的帮助文件地址

Recommended tutorial: " PHP》《Linux Operation and Maintenance

The above is the detailed content of How to use whereis command in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn