1, the search for the command
The which command can find the path in the directory that is configured under the $PATH environment variable. The role of the environment variable is when we execute the command, the system will be in the environment variable configuration of the directory to find the command, if not found on the error.
Which LS-to/bin/ls this is where the LS command's executable file is stored
2. Find Files 2.1, three find commands
1) whereis Whereid optional parameter file or directory name is used to find binary files, documentation, source files, etc.
2) Locate can be used to check
3) Find
Find is very powerful, can be based on user, group, name, file size, permissions, time and so on to find files, but also to find a range of files, such as the size of a file to find files, find/-size +100k, this means to find/ Files or directories with file sizes larger than 100k in the directory
2.2. The Linux system backs up the system files to the database
Linux system will record all the files in the system in a database file, and when using Whereis or locate, will be the contents of this database file, the results in the database to search for the location of the file, and find is directly search the hard disk. As a result, whereis and locate find faster than find, and sometimes you'll find files that have been killed when you use both of them! And you can't find the latest file you just created! Because the files in the Linux system and the files in the database are not always synchronized, there is a certain error in the two methods of finding. The time to update the database for each type of description is not the same. Of course, we can manually update the database, but this process will be slow, update the method is to directly execute updatedb.
Locate find the process: according to the database records in the/var/lib/mlocate, find the user input keyword file name.
The process of updating the database is to search the file name of the system hard disk according to the configuration of/etc/updatedb.conf, and upgrade the database files in/var/lib/mlocate;
Linux command and file lookups which, Wheris, locate, find