1. File name Lookup
Use Find query, because disk query, so slow, so Linux query more often use which, whereis, locate to query, because it is using database query, so fast.
2. Which
We commonly use the LS command, and if we want to know where these common commands are placed, the which command is used to query the address. which uses the PATH environment variable to find the filename, WHICH-A returns all the commands found, and returns the first one by default. $ which grep
/bin/grep
$ which LL
Alias ll= ' Ls-l--color=tty '
/bin/ls
#使用alias别名
3. Whereis
Whereis used to query program name $ whereis
Whereis [-SBMU] [-SBM dir ...-f] name ...
-B: Finding binary format files
-S: Find source file
-M: Find files under the manual path of the description file
-U: Find special files that are not in the above three options
For example $ whereis grep
grep:/bin/grep/usr/share/man/man1/grep.1.gz/usr/share/man/man1p/grep.1p.gz
#查询二进制文件
$ whereis-b grep
grep:/bin/grep
#查询手册说明文件 Mans grep
$ whereis-m grep
grep:/usr/share/man/man1/grep.1.gz/usr/share/man/man1p/grep.1p.gz
4. Locate
Linux lists the files in the system in a database file (/var/lib/slocate/slocate.db). Locate through the database file query.
Generally this file is updated daily, configured in/etc/updatedb.conf to update daily, and update the directory. Can run $ updatedb manually
To update the database. Using locate, follow the command to $ locate passwd