Linux下搜寻文件,通常都是用whereis或locate来检查,因为whereis和locate是利用数据库来搜寻数据,所以速度相当快,而且并没有实际的搜寻硬盘。下面介绍whereis的参数和用法。
1.命令格式:
whereis [-bmsu] [BMS 目录名 -f ] 文件名
命令参数
-b 定位可执行文件。
-m 定位帮助文件。
-s 定位源代码文件。
-u 搜索默认路径下除可执行文件、源代码文件、帮助文件以外的其它文件。
-B 指定搜索可执行文件的路径。
-M 指定搜索帮助文件的路径。
-S 指定搜索源代码文件的路径。
使用实例:
**实例一:将和文件相关的文件都查找出来
命令:whereis svn
[root@localhost ~]# whereis tomcat
tomcat:
[root@localhost ~]# whereis svn
svn: /usr/bin/svn /usr/local/svn /usr/share/man/man1/svn.1.gz
**实例二:**定位某类文件
命令: whereis -b svn 查找可执行文件路径
whereis -m svn 查找说明文档路径
whereis -s svn 查找源文件路径
[root@localhost ~]# whereis -b svn
svn: /usr/bin/svn /usr/local/svn
[root@localhost ~]# whereis -m svn
svn: /usr/share/man/man1/svn.1.gz
[root@localhost ~]# whereis -s svn
svn:
[root@localhost ~]#文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/217368.html<

