Home  >  Article  >  System Tutorial  >  Master the skills of Linux whereis command

Master the skills of Linux whereis command

王林
王林Original
2024-02-25 16:24:07976browse

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.

1. Basic usage of whereis 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.

2. Tips for whereis command

2.1 Find the executable file of the command

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.

2.2 Limit the search scope

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.

2.3 Search for multiple 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.

3. Specific code example

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.

Conclusion

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!

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