One linux command every day (18): locate command link: One linux command every day (1): ls command http://www.2cto.com/os/201210/163049.html ; One linux command every day (2): cd command http://www.2cto.com/os/201210/163050.html A linux command (18): locate command link: A linux command (1): ls command every day http://www.2cto.com/os/201210/163049.html ; One linux command every day (2): cd command http://www.2cto.com/os/201210/163050.html ; One linux command every day (3): pwd command http://www.2cto.com/os/201210/163462.html ; One linux command every day (4): mkdir command http://www.2cto.com/os/201210/163463.html ; One linux command every day (5): rm command http://www.2cto.com/os/201210/163662.html ; One linux command (6) every day: rmdir command http://www.2cto.com/os/201210/164017.html ; One linux command (7) every day: mv command http://www.2cto.com/os/201210/164247.html ; One linux command every day (8): cp command http://www.2cto.com/os/201210/164254.html ; One linux command every day (9): touch Command http://www.2cto.com/os/201211/165699.html ; One linux command every day (10): cat command http://www.2cto.com/os/201211/165989.html ; One linux command every day (11): nl command http://www.2cto.com/os/201211/165990.html One linux command every day (12): more command http://www.2cto.com/os/201211/165994.html One linux command every day (13): less command http://www.2cto.com/os/201211/165998.html One linux command every day (14): head Command http://www.2cto.com/os/201211/166191.html One linux command every day (15): tail command http://www.2cto.com/os/201211/168702.html One linux command every day (16): which command http://www.2cto.com/os/201211/168890.html A linux command (17) every day: whereis command http://www.2cto.com/os/201211/168893.html Locate allows users to quickly search for specified files in the file system. The method is to first create a database that includes the names and paths of all files in the system. then, you only need to query the database when searching, instead of going into the file system. In general distribution, database creation is automatically executed in crontab. Www.2cto.com 1. command format: Locate [Select parameter] [style] 2. command function: the locate command can be used to quickly find files when searching for a database. the database is updated by the updatedb program, and the updatedb is periodically created by the cron daemon, the locate command is faster than searching for data from the entire hard disk, but worse is that the files found by the locate are created recently or renamed, it may not be found. in the specified value, updatedb runs once a day. you can modify crontab to update the set value. (Etc/crontab) locate is used to search for qualified files. it stores the files and directory names in the database to find files or directories that meet the template style conditions, special characters (such as "*" or "?") To specify the template style. for example, if you specify the template as the kcpa * ner, locate will find all the files or directories whose start string is kcpa and end with the ner, for example, if the directory name is kcpartner and the directory name is kcpa_ner, all files including subdirectories in the directory are listed. The locate command is similar to the find File query function. However, the locate program uses the update program to create an index database for all files and directories on the hard disk. when executing the loacte command, it directly finds the index, the query speed is faster. The index database is generally managed by the operating system, but you can also directly issue an update command to force the system to immediately modify the index database. 3. command parameter:-e will be excluded from the search range. -1 if it is 1. the security mode is enabled. In security mode, users do not see files that cannot be viewed by permissions. This slows down because the locate must obtain the permission information for the file in the actual file system. -F exclude a specific file system. for example, we have no reason to put the files in the proc file system in the database. -Q Quiet mode. no error message is displayed. -N: displays up to n outputs. -R uses the regular formula for search conditions. -O specifies the data inventory name. -D specifies the path of the database-h displays the auxiliary message-V displays the version information of the program 4. use instance: instance 1: Find all pwd-related file commands: locate pwd output: peida-VirtualBox ~ # Locate pwd/bin/pwd/etc /. pwd. lock/sbin/unix_chkpwd/usr/bin/pwdx/usr/include/pwd. h/usr/lib/python2.7/dist-packages/twisted/python/fakepwd. py/usr/lib/python2.7/dist-packages/twisted/python/fakepwd. pyc/usr/lib/python2.7/dist-packages/twisted/python/test/test_fakepwd.py/usr/lib/python2.7/dist-packages/twisted/python/test/tests/usr/ lib/syslinux/pwd. c32/usr/share/help/C/empathy/irc-join-pwd. Page/usr/share/help/ca/empathy/irc-join-pwd.page/usr/share/help/cs/empathy/irc-join-pwd.page/usr/share/help/de/empathy/irc-join-pwd.page/usr/ share/help/el/empathy/irc-join-pwd.page instance 2: search all files starting with sh in The etc directory. Command: locate/etc/sh output: peida-VirtualBox ~ # Locate/etc/sh/etc/shadow-/etc/shellspeida-VirtualBox ~ # Instance 3: Search for all files starting with m in The etc directory. Command: locate/etc/m output: peida-VirtualBox ~ # Locate/etc/m/etc/magic. mime/etc/mailcap. order/etc/manpath. config/etc/mate-settings-daemon
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.