每天一个linux命令(17):whereis 命令
来源:互联网 发布:收购淘宝天猫评价 编辑:程序博客网 时间:2024/05/18 03:24
whereis命令只能用于程序名的搜索,而且只搜索二进制文件(参数-b)、man说明文件(参数-m)和源代码文件(参数-s)。如果省略参数,则返回所有信息。
和find相比,whereis查找的速度非常快,这是因为linux系统会将 系统内的所有文件都记录在一个数据库文件中,当使用whereis和下面即将介绍的locate时,会从数据库中查找数据,而不是像find命令那样,通 过遍历硬盘来查找,效率自然会很高。
但是该数据库文件并不是实时更新,默认情况下时一星期更新一次,因此,我们在用whereis和locate 查找文件时,有时会找到已经被删除的数据,或者刚刚建立文件,却无法查找到,原因就是因为数据库文件没有被更新。
1.命令格式:
whereis [-bmsu] [BMS 目录名 -f ] 文件名
2.命令功能:
whereis命令是定位可执行文件、源代码文件、帮助文件在文件系统中的位置。这些文件的属性应属于原始代码,二进制文件,或是帮助文件。whereis 程序还具有搜索源代码、指定备用搜索路径和搜索不寻常项的能力。
3.命令参数:
-b 定位可执行文件。-m 定位帮助文件。-s 定位源代码文件。-u 搜索默认路径下除可执行文件、源代码文件、帮助文件以外的其它文件。-B 指定搜索可执行文件的路径。-M 指定搜索帮助文件的路径。-S 指定搜索源代码文件的路径。
4.使用实例:
实例1:将和**文件相关的文件都查找出来
命令:
huxiang@shenyong-Opt790:~$ whereis pythonpython: /usr/bin/python3.4 /usr/bin/python2.7 /usr/bin/python3.4m /usr/bin/python /usr/bin/python2.7-config /etc/python3.4 /etc/python2.7 /etc/python /usr/lib/python3.4 /usr/lib/python2.7 /usr/bin/X11/python3.4 /usr/bin/X11/python2.7 /usr/bin/X11/python3.4m /usr/bin/X11/python /usr/bin/X11/python2.7-config /usr/local/lib/python3.4 /usr/local/lib/python2.7 /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gzhuxiang@shenyong-Opt790:~$ whereis -m pythonpython: /usr/share/man/man1/python.1.gzhuxiang@shenyong-Opt790:~$ whereis -s python
0 0
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个 Linux 命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 每天一个 Linux 命令(17):whereis 命令
- 每天一个 Linux 命令(17):whereis 命令
- 每天一个 Linux 命令(17):whereis 命令
- 每天一个Linux命令(17):whereis命令
- 每天一个linux命令(17):whereis 命令
- 每天一个linux命令(17):whereis 命令
- 解决 The `master` repo requires CocoaPods 1.0.0 - (currently using 0.39.0)
- django signal
- mybatis动态sql
- mysql常用操作语句
- 活动目录 powershell 从组中 添加\删除 用户
- 每天一个linux命令(17):whereis 命令
- Python中字典
- SpringMVC源码总结(三)mvc:annotation-driven和mvc:message-converters简单介绍
- 揭秘月入100W的互联网黑色产业
- 调试遗漏IoStartNextPacket引起的阻塞
- openWRT中lua脚本的星号问题
- 正则表达式总结
- 极限验证,滑动验证-java实现
- erlang mnesia 数据库备份与还原机制