whereis:查找文件
2019-12-13 本文已影响0人
7ed8e3680ebe
Linux教程:http://www.fdlly.com/m/linux
本文介绍linux的whereis命令功能说明、语法、选项与参数、使用详解,并演示如何使用whereis命令在linux上查找文件
whereis:查找文件
whereis命令通过预生成的一个文件列表库查找二进制程序、源代码文件和 man 手册页等相关文件的路径
在用 whereis 和 locate 查找文件时,有时会找到已被删除的数据,或者刚刚建立文件却无法查找到,原因就是因为数据库文件没有被更新
语法
功能说明:查找文件
语法:
whereis [参数] [文件名]
选项与参数:
-
-b
:只查找二进制文件 -
-B<目录>
:只在指定目录下查找二进制文件 -
-f
:不显示文件名前的路径名称 -
-m
:只查找说明文件 -
-M<目录>
:只在指定目录下查找说明文件 -
-s
:只查找原始代码文件 -
-S<目录>
:只在指定目录下查找原始代码文件 -
-u
:查找不包括指定类型的文件
实例
查找
[root@localhost /]# whereis ls ps
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
ps: /usr/bin/ps /usr/share/man/man1/ps.1.gz
查找为二进制文件
[root@localhost /]# whereis -b top
top: /usr/bin/top
查找说明文档路径
[root@localhost /]# whereis -m top
top: /usr/share/man/man1/top.1.gz
查找source源文件
[root@localhost /]# whereis -s top