Linux命令locate

centos安装locate命令

centos6.3刚初始化安装完毕,有个配置文件不知道存在什么地方,想用locate命令来查找下,发现系统提示,找不到该命令。以前经常用的命令为什么找不到了呢???原来现在的6.3的已经将原来的locate命令因为效率低下的问题,已经弃用了。用现在最新的mlocate中的locate来代替原来的locate命令了。

所以大家想继续使用locate命令的话,就先安装一下吧。

1
2
# yum install mlocate
# updatedb

运行完毕上面的两条命令之后,就可以使用自己久违的locate命令了。
附locate的参数.

Usage: locate [OPTION]… [PATTERN]…
Search for entries in a mlocate database.

-b, –basename         match only the base name of path names
-c, –count            only print number of found entries
-d, –database DBPATH  use DBPATH instead of default database (which is
/var/lib/mlocate/mlocate.db)
-e, –existing         only print entries for currently existing files
-L, –follow           follow trailing symbolic links when checking file
existence (default)
-h, –help             print this help
-i, –ignore-case      ignore case distinctions when matching patterns
-l, –limit, -n LIMIT  limit output (or counting) to LIMIT entries
-m, –mmap             ignored, for backward compatibility
-P, –nofollow, -H     don’t follow trailing symbolic links when checking file
existence
-0, –null             separate entries with NUL on output
-S, –statistics       don’t search for entries, print statistics about each
used database
-q, –quiet            report no error messages about reading databases
-r, –regexp REGEXP    search for basic regexp REGEXP instead of patterns
–regex            patterns are extended regexps
-s, –stdio            ignored, for backward compatibility
-V, –version          print version information
-w, –wholename        match whole path name (default)

原文:http://www.yuweixian.com/linux/centos-install-locate.html

原文地址:https://www.cnblogs.com/wzlbigdata/p/8401029.html