1. File name Lookup
When using the Find query, because the disk query, so slow, so the Linux query more often use which, whereis, locate to query, because it is the use of database queries, so fast.
2. Which
Our common ls command, if we want to know where these common 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
For example
$ 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 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.
Generally this file is updated daily, configured in/etc/updatedb.conf to configure whether to update daily, and update the directory. can be run manually
$ updatedb
To update the database. Use locate, followed by commands
$ locate passwd
Address: http://blog.csdn.net/yonggang7/article/details/37960767
Linux file name lookup which,whereis,locate