Linux whereis Command: Function Explained

The whereis command is used in Linux systems to locate the executable files, source code files, and documentation of a specified command. It is used to find the binary file of a specific command and other related files.

Here is the syntax for this command:

whereis [选项] 命令

One of them is the command parameter, which is the name of the command to be searched.

The “whereis” command searches the system’s default paths (/bin, /sbin, /usr/bin, /usr/sbin, etc.) to locate the executable file of a specified command. It can also search for the source code files and help documents of the specified command (using the -b and -m options).

Here are some examples:

whereis ls    # 查找ls命令的可执行文件、源代码文件和帮助文档所在的位置
whereis java  # 查找java命令的可执行文件所在的位置
whereis gcc   # 查找gcc命令的可执行文件和帮助文档所在的位置

The whereis command is commonly used to find the location of a specific command, so that it can be easily accessed when needed or its related files can be viewed.

bannerAds