Linux file name look which, whereis, locate

  
1. File name lookup
When using find query, due to disk query, so the speed is slow, so the query under linux more often use which, whereis, locate to query, because it is the use of the database Query, so it's fast. 2. which
Our commonly used 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 commands found, and returns the first one by default. $ which grep/bin/grep$ which llalias ll='ls -l --color=tty' /bin/ls #Use alias alias 3. whereis
whereis is used to query the program name $whereiswhereis [ -sbmu ] [ - SBM dir ... -f ] name...-b : Find the binary format file -s : Find the source source file -m : Find the file in the manual path of the documentation -u : Find specials that are not in the above three options For example, $whereis grepgrep: /bin/grep /usr/share/man/man1/grep.1.gz /usr/share/man/man1p/grep.1p.gz# Query binary $ 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 files in the system in a database file (/var/lib/slocate/slocate.db). Locate queries through database files. Usually this file is updated once a day, configured in /etc/updatedb.conf to configure whether to update daily, and update the directory. You can manually run $updateb to update the database. Use locate, followed by the command to $locate passwd address: http://blog.csdn.net/yonggang7/article/details/37960767
Copyright © Windows knowledge All Rights Reserved