1. File name Lookup
When you use the Find query. Because of a disk query. Therefore, the speed is relatively slow. So Linux under query more often use which, whereis, locate to query, because is the use of database queries. So the speed is very fast.
2. Which
We often use the LS command. Let's say we want to know where these often use commands are placed. Use the which command to query the address. which uses the PATH environment variable to find the file name, WHICH-A returns all the found commands, and returns the first one by default.
$ which grep/bin/grep$ which Llalias ll= ' ls-l--color=tty ' /bin/ls #使用alias别名
3. Whereis
Whereis used to query the program name
$ whereiswhereis [-SBMU] [-SBM dir ...-f] name...-b: Find binary Format file-S: Find source file-M: Find file under Description file manual path-u: Find not above three Special files in the options
Like what
$ whereis grepgrep:/bin/grep/usr/share/man/man1/grep.1.gz/usr/share/man/man1p/grep.1p.gz# query binary file $ whereis-b grep grep:/bin/grep# Query Manual manual description file man grep $ whereis-m grepgrep:/usr/share/man/man1/grep.1.gz/usr/share/man/man1p/grep.1p.gz
3. Locate
Linux lists the in-system files in a database file (/var/lib/slocate/slocate.db). Locate is queried through the database file.
This file is usually updated daily. Configure whether the configuration is updated daily in/etc/updatedb.conf. and update folders. Ability to perform manually
$ updatedb
To update the database.
Use locate. You can follow the instructions later.
$ locate passwd
Address: http://blog.csdn.net/yonggang7/article/details/37960767
Linux file name lookup which,whereis,locate