Linux定位文件位置性能处理,Linux whereis定位文件位置命令操作

玩蛇网推荐图文教程:python 列表

Linux whereis定位文件位置命令操作,关于whereis功能简述:whereis命令是定位可执行文件、源代码文件、帮助文件在文件系统中的位置。这些文件的属性应属于原始代码,二进制文件,或是帮助文件。whereis 程序还具有搜索源代码、指定备用搜索路径和搜索不寻常项的能力。和find相比,whereis查找的速度非常快,这是因为linux系统会将系统内的所有文件都记录在一个数据库文件中,当使用whereis和下面即将介绍的locate时,会从数据库中查找数据,而不是像find命令那样,通过遍历硬盘来查找,效率自然会很高。但此数据库没有实时更新,有时候新建的文件会找不到,需要手动更新此数据库。

Linux whereis语法:whereis [-bmsu] [BMS 目录名-f ] 文件名

Linux whereis命令参数:

-b 定位可执行文件。

-m 定位帮助文件。

-s 定位源代码文件。

-u 搜索默认路径下除可执行文件、源代码文件、帮助文件以外的其它文件。

-B 指定搜索可执行文件的路径。

-M 指定搜索帮助文件的路径。

-S 指定搜索源代码文件的路径。

Linux whereis定位文件位置命令操作:查找和crontab文件相关的文件

[atong@LiWenTong tmp]$ whereis crontab

crontab: /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

Linux whereis定位文件位置命令操作:指定查找的文件类别

[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 vi

vi: /usr/bin/vi /usr/share/vi /usr/share/man/man1/vi.1.gz

mao:~# whereis man

man: /usr/bin/man /usr/local/man /usr/share/man /usr/share/man/man1/man.1.gz /usr/share/man/man7/man.7.gz

mao:~# whereis yes

yes: /usr/bin/yes /usr/share/man/man1/yes.1.gz

mao:~# whereis echo

echo: /bin/echo /usr/share/man/man1/echo.1.gz

mao:~# whereis less

less: /usr/bin/less /usr/share/man/man1/less.1.gz

mao:~# whereis fcitx

fcitx: /usr/bin/fcitx /usr/share/fcitx

Linux whereis定位文件位置命令操作总结:whereis其实跟我们的locate和which的功能很像,也是能够查找执行文件和文件,还能够查找帮助文件。基本这个命令应该可以被which和locate替代的。

玩蛇网文章,转载请注明出处和文章网址:https://www.iplaypy.com/linux/l6856.html

相关文章 Recommend

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值