Welcome 微信登录

首页 / 操作系统 / Linux / Linux whereis命令详解

Whereis命令

功能简述:whereis命令是定位可执行文件、源代码文件、帮助文件在文件系统中的位置。这些文件的属性应属于原始代码,二进制文件,或是帮助文件。whereis 程序还具有搜索源代码、指定备用搜索路径和搜索不寻常项的能力。和find相比,whereis查找的速度非常快,这是因为linux系统会将系统内的所有文件都记录在一个数据库文件中,当使用whereis和下面即将介绍的locate时,会从数据库中查找数据,而不是像find命令那样,通过遍历硬盘来查找,效率自然会很高。但此数据库没有实时更新,有时候新建的文件会找不到,需要手动更新此数据库。语法:whereis [-bmsu] [BMS 目录名-f ] 文件名命令参数:-b 定位可执行文件。-m 定位帮助文件。-s 定位源代码文件。-u 搜索默认路径下除可执行文件、源代码文件、帮助文件以外的其它文件。-B 指定搜索可执行文件的路径。-M 指定搜索帮助文件的路径。-S 指定搜索源代码文件的路径。 查找和crontab文件相关的文件[atong@LiWenTong tmp]$ whereis crontabcrontab: /usr/bin/crontab /etc/crontab/usr/share/man/man1/crontab.1.gz /usr/share/man/man5/crontab.5.gz/usr/share/man/man1p/crontab.1p.gz 指定查找的文件类别[atong@LiWenTong tmp]$ whereis -b crontab—》指定查找二进制文件,也就是可执行文件crontab: /usr/bin/crontab /etc/crontab[atong@LiWenTong tmp]$ whereis -m crontab-->指定查找帮助文件crontab: /usr/share/man/man1/crontab.1.gz/usr/share/man/man5/crontab.5.gz /usr/share/man/man1p/crontab.1p.gz[网络上的实例]mao:~# whereis vivi: /usr/bin/vi /usr/share/vi /usr/share/man/man1/vi.1.gzmao:~# whereis manman: /usr/bin/man /usr/local/man /usr/share/man /usr/share/man/man1/man.1.gz /usr/share/man/man7/man.7.gzmao:~# whereis yesyes: /usr/bin/yes /usr/share/man/man1/yes.1.gzmao:~# whereis echoecho: /bin/echo /usr/share/man/man1/echo.1.gzmao:~# whereis lessless: /usr/bin/less /usr/share/man/man1/less.1.gzmao:~# whereis fcitxfcitx: /usr/bin/fcitx /usr/share/fcitx------------------------后续自我小结---------------whereis其实跟我们的locate和which的功能很像,也是能够查找执行文件和文件,还能够查找帮助文件。基本这个命令应该可以被which和locate替代的。--------------------------------------------------Linux下的文件查找——type whereis which find locate http://www.linuxidc.com/Linux/2013-06/86038.htmLinux which命令详解Linux locate命令详解相关资讯      Linux命令详解  whereis命令 
  • Linux 命令详解 chpasswd 批量修改  (02/13/2015 20:15:05)
  • Linux系统性能分析命令ps.pstree及  (06/27/2014 20:27:00)
  • Linux which命令详解  (12/27/2013 08:51:38)
  • Linux ln命令详解及使用  (07/24/2014 14:08:52)
  • Linux locate命令详解  (12/27/2013 08:56:14)
  • Linux sleep 命令详解[图文]  (07/28/2013 11:59:34)
本文评论 查看全部评论 (0)
表情: 姓名: 字数