The whereis command in Linux system is used to locate the location of the executable file, source file and help file of the specified command. By mastering the skills of the whereis command, you can find the required files more easily and improve work efficiency. This article will introduce the basic usage and some techniques of whereis command, and provide specific code examples to help readers better understand and apply this command.
The basic syntax of whereis command is as follows:
whereis [选项] [文件名]
Among them, the options include:
-b
: Limit the search for executable files. -m
: Limit the search for help files. -s
: Limit the search for source files. -u
: Displays files that are not used by the Linux kernel in the system. If you want to find the executable file path of a specific command, you can use the following command :
whereis ls
Running the above command will return the executable file path corresponding to the ls command, so you can easily find the location of the command.
If you only want to find the executable file of the command, you can use the -b
option:
whereis -b ls
This will only search for the ls command executable files, but not other types of files.
You can search for multiple files at one time, for example:
whereis ls cp
This will search for the executable file paths of the ls and cp commands at the same time.
The following is a specific code example that demonstrates how to use the whereis command to find the executable file path of a specific command:
# 查找ls命令的可执行文件路径 whereis ls
After running the above command , the system will return the executable file path of the ls command, making it easier for users to find the location of the command.
By mastering the basic usage and skills of the whereis command, you can more easily find the executable file, source file and help file of a specific command in the Linux system. I hope readers can deepen their understanding of the whereis command through the introduction and examples of this article, and use it skillfully in actual work to improve work efficiency.
The above is the detailed content of Master the skills of Linux whereis command. For more information, please follow other related articles on the PHP Chinese website!