I. Query for script file names
Which----looking for execution files
which [-A] command
-A: Lists all the commands that can be found in the path directory, instead of listing only the first
\
Alis is followed by a command alias, which means that the input LS is equivalent to some of the input.
Description: This command is based on the path inside the paths to find. And the which is followed by the full file name.
Two. Finding the file name
Whereis/locate is usually used, and find is not used much. Find is only used when you can't find it, because both Whereis and locate use the database to find it, so it's fast. And find is found on the hard disk.
(1) Whereis (find a specific file)
Whereis [-BMSU] file name or directory name
-B: Only binary files are found
-M: Just look for the file below the description directory/man
-S: Only source files are found
-U: No special files found in the above three options
(2) Locate
Locate [-ir] keyword
-I: No matter the case
-R: Can be followed by regular expression
When using locate, you can get results by typing "part of file name" directly in the back. This is a different place from the Whereis.
As you can see, you can only use locate.
Attention:
Whereis and locate also have restrictions on usage, and when using them, the data is looked up from the database that has been created/var/lib/mlocate. So fast, but the database default is updated every day, so there can not find the latest files, This time we can enter the UpdateDB update database, this command will read/etc/updatedb.config the configuration file settings, and then go to the hard disk to update operations. This process takes a few minutes.
(3) Find
Find [PATH] [option] [action]
1. Find files belonging to Chuiyuan users under/home
2. Find files that are not part of anyone in your system
This command can be used to find abnormal files, but sometimes it is normal, especially in the source code method to compile software.
3. Find the file named Vi1test1
Vi1test1 is a new file, so using locate cannot be found.
4. Find the file name of the directory/var type socket
5. Wildcard Lookup
Chapter7:linux File and Directory Management (3) command and file query