简介
whereis命令查找速度非常快,因为它不是在磁盘中乱找,而是在一个数据库中查询; 是系统自动创建的,包含有本地所有文件的信息,并且每天通过自动执行 updatedb命令 更新一次。正因为这样,whereis命令的搜索结果有时候会不准确,比如刚添加的文件可能搜不到, 原因就是该数据库文件没有被更新。
格式
whereis [options] [-BMS directory… -f] name…
常用参数
-b | 查找二进制程序或命令 |
---|---|
-B | 从指定目录下 查找二进制程序或命令 |
-m | 查找man手册文件 |
-M | 从指定目录下 查找man手册文件 |
-s | 只查找源代码文件 |
-S | 从指定目录下 查找源代码文件 |
-l | 查看 whereis 的搜索路径 |
示例
## 不加参数 默认都显示
[root@localhost ~]# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
[root@localhost ~]# whereis -b ls
ls: /usr/bin/ls
[root@localhost ~]# whereis -m ls
ls: /usr/share/man/man1/ls.1.gz
[root@localhost ~]# whereis -l
bin: /usr/bin
bin: /usr/sbin
bin: /usr/lib
bin: /usr/lib64
bin: /etc
bin: /usr/etc
bin: /usr/games
bin: /usr/local/bin
bin: /usr/local/sbin
bin: /usr/local/etc
bin: /usr/local/lib
bin: /usr/local/games
bin: /usr/include
。。。。。