It is inevitable to forget the location of files when using a Linux system. You can use the following command to search for files in the system. The commands to search for files are "find"; "locate"; "whereis"; "which"; "type"
# #The most powerful search command under Linux is "find". Its format is "find
"; for example, use the find command to search for the location of all interfaces files in the root directory, and the command format is "find / -name '*.sh'" (Recommended learning: linux operation and maintenance)
Use locate to search for files in the linux system, which is better than find Order quickly. Because it queries the database (/var/lib/locatedb), the database contains all local file information. Use the locate command to search for interfaces files in the root directory. The command is "locate *.sh"
Use the "whereis" command to search in the Linux system All executable files are binary files. The command to search grep binary files using the whereis command is "whereis grep".
Use the which command to check whether the system command exists and return the location of the system command. Use the which command to check whether the grep command exists and the existing directory is "which grep".
Use the type command to check whether a command in the system is a command that comes with the system. Use the type command to check whether the cd command is a built-in command of the system; check whether grep is a built-in command of the system.
The above is the detailed content of How to search files 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