linux 命令:whereis详解

linux 命令:whereis详解linux命令:whereis详解

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

名称

        whereis – 定位一个“命令”的二进制文件、源文件、手册文件。

用法

        whereis [options] [-BMS directory… -f] name…

描述

        whereis 定位一个指定“命令”的二进制文件、源文件、手册文件的位置。提供的名称首            先去除前导路径名组件和任何(单个)尾随 .ext 扩展名(例如:.c)。使用源代码控制          产生的前缀 “s.” 也得到处理。然后 whereis 尝试在标准 Linux 位置以及 $PATH 和                  $MANPATH 指定的位置中定位所需的程序。

选项

        -b        只搜索二进制文件。

        -m       只搜索手册文件。

        -s        只搜索源文件。

        -u        只展示有特殊条目的命令名称。如果一个命令对于每个明确请求的类型不只有                       一个条目,则称该命令是不寻常的。因此 “whereis -m -u *” 请求在当前目录中                       没有文档文件或有多个文档文件的文件。

        -B list  使用空格分隔的目录列表限制查找二进制文件的范围。

        -M list 使用空格分隔的目录列表限制查找手册文件的范围。

        -S list  使用空格分隔的目录列表限制查找源文件的范围。

        -f         终止目录列表并表示文件名的开始。

        -l         输出 whereis 使用的有效查找路径的列表。 当指定非 -B、-M 或 -S 时,该选项                     将输出该命令能够在系统上找到的硬编码路径。

使用示例:

1. whereis:展示二进制文件、源文件、手册文件的位置。

[root@server bin]# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz

Jetbrains全家桶1年46,售后保障稳定

2. whereis -b/m/s:只展示其中一项。

[root@server bin]# whereis -b ls
ls: /usr/bin/ls
[root@server bin]# whereis -m ls
ls: /usr/share/man/man1/ls.1.gz
[root@server bin]# whereis -s ls
ls:[root@server bin]#

3. whereis -B/M/S:限定查找目录,必须使用 -f ,否则 whereis 会把命令名当成目录

[root@server bin]# whereis -s -S /usr/src -f ls
ls:[root@server bin]# whereis -m -M /usr/share/man/man1 -f ls
ls: /usr/share/man/man1/ls.1.gz
[root@server bin]# whereis -b -B /usr/bin -f ls
ls: /usr/bin/ls

4. whereis -u:限定特殊命令。

[root@server bin]# whereis -u -ms -M /usr/man/man1 -S /usr/src -f *
ar: /usr/bin/ar /usr/include/ar.h
at: /usr/bin/at /etc/at.deny
awk: /usr/bin/awk /usr/libexec/awk /usr/share/awk
cancel: /usr/bin/cancel.cups /usr/bin/cancel
cancel: /usr/bin/cancel.cups /usr/bin/cancel
cloud-init: /usr/bin/cloud-init /usr/lib/cloud-init
cpio: /usr/bin/cpio /usr/include/cpio.h
cpp: /usr/bin/cpp /usr/lib/cpp
crontab: /usr/bin/crontab /etc/crontab
dracut: /usr/bin/dracut /usr/sbin/dracut /usr/lib/dracut /etc/dracut.conf
file: /usr/bin/file /usr/share/file
fipscheck: /usr/bin/fipscheck /usr/lib64/fipscheck
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc
genl-ctrl-list: /usr/bin/genl-ctrl-list /usr/sbin/genl-ctrl-list
getconf: /usr/bin/getconf /usr/libexec/getconf
getopt: /usr/bin/getopt /usr/include/getopt.h
gettext: /usr/bin/gettext /usr/bin/gettext.sh /usr/lib64/gettext /usr/share/gettext
gettext: /usr/bin/gettext /usr/bin/gettext.sh /usr/lib64/gettext /usr/share/gettext
gio: /usr/bin/gio /usr/lib64/gio
groff: /usr/bin/groff /etc/groff /usr/share/groff
hostname: /usr/bin/hostname /etc/hostname
iconv: /usr/bin/iconv /usr/include/iconv.h
info: /usr/bin/info /usr/share/info
lastlog: /usr/bin/lastlog /usr/include/lastlog.h
ld: /usr/bin/ld.gold /usr/bin/ld /usr/bin/ld.bfd
ld: /usr/bin/ld.gold /usr/bin/ld /usr/bin/ld.bfd
ld: /usr/bin/ld.gold /usr/bin/ld /usr/bin/ld.bfd
link: /usr/bin/link /usr/include/link.h
locale: /usr/bin/locale /usr/lib/locale /etc/locale.conf /usr/include/locale.h /usr/share/locale
login: /usr/bin/login /etc/login.defs
lp: /usr/bin/lp /usr/bin/lp.cups
lp: /usr/bin/lp /usr/bin/lp.cups
lpq: /usr/bin/lpq /usr/bin/lpq.cups
lpq: /usr/bin/lpq /usr/bin/lpq.cups
lpr: /usr/bin/lpr /usr/bin/lpr.cups
lpr: /usr/bin/lpr /usr/bin/lpr.cups
lprm: /usr/bin/lprm /usr/bin/lprm.cups
lprm: /usr/bin/lprm /usr/bin/lprm.cups
lpstat: /usr/bin/lpstat /usr/bin/lpstat.cups
lpstat: /usr/bin/lpstat /usr/bin/lpstat.cups
lua: /usr/bin/lua /usr/lib64/lua /usr/share/lua
mail: /usr/bin/mail /etc/mail.rc
mailq: /usr/bin/mailq.postfix /usr/bin/mailq
mailq: /usr/bin/mailq.postfix /usr/bin/mailq
man: /usr/bin/man /usr/share/man
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/share/mysql
newaliases: /usr/bin/newaliases /usr/bin/newaliases.postfix
newaliases: /usr/bin/newaliases /usr/bin/newaliases.postfix
nl-class-add: /usr/bin/nl-class-add /usr/sbin/nl-class-add
nl-class-delete: /usr/bin/nl-class-delete /usr/sbin/nl-class-delete
nl-classid-lookup: /usr/bin/nl-classid-lookup /usr/sbin/nl-classid-lookup
nl-class-list: /usr/bin/nl-class-list /usr/sbin/nl-class-list
nl-cls-add: /usr/bin/nl-cls-add /usr/sbin/nl-cls-add
nl-cls-delete: /usr/bin/nl-cls-delete /usr/sbin/nl-cls-delete
nl-cls-list: /usr/bin/nl-cls-list /usr/sbin/nl-cls-list
nl-link-list: /usr/bin/nl-link-list /usr/sbin/nl-link-list
nl-pktloc-lookup: /usr/bin/nl-pktloc-lookup /usr/sbin/nl-pktloc-lookup
nl-qdisc-add: /usr/bin/nl-qdisc-add /usr/sbin/nl-qdisc-add
nl-qdisc-delete: /usr/bin/nl-qdisc-delete /usr/sbin/nl-qdisc-delete
nl-qdisc-list: /usr/bin/nl-qdisc-list /usr/sbin/nl-qdisc-list
openssl: /usr/bin/openssl /usr/lib64/openssl
os-prober: /usr/bin/os-prober /usr/share/os-prober
p11-kit: /usr/bin/p11-kit /usr/libexec/p11-kit /usr/share/p11-kit
passwd: /usr/bin/passwd /etc/passwd
ping6: /usr/bin/ping6 /usr/sbin/ping6
pip: /usr/bin/pip2.7 /usr/bin/pip
pip2: /usr/bin/pip2 /usr/bin/pip2.7
pip2: /usr/bin/pip2 /usr/bin/pip2.7
plymouth: /usr/bin/plymouth /usr/lib64/plymouth /etc/plymouth /usr/libexec/plymouth /usr/share/plymouth
printf: /usr/bin/printf /usr/include/printf.h
pstree: /usr/bin/pstree /usr/bin/pstree.x11
pstree: /usr/bin/pstree /usr/bin/pstree.x11
pwd: /usr/bin/pwd /usr/include/pwd.h
python: /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7
python2: /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python2 /usr/lib/python2.7 /usr/lib64/python2.7 /usr/include/python2.7
python2: /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python2 /usr/lib/python2.7 /usr/lib64/python2.7 /usr/include/python2.7
python2: /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python2 /usr/lib/python2.7 /usr/lib64/python2.7 /usr/include/python2.7
rmail: /usr/bin/rmail /usr/bin/rmail.postfix
rmail: /usr/bin/rmail /usr/bin/rmail.postfix
rpm: /usr/bin/rpm /usr/lib/rpm /etc/rpm
screen: /usr/bin/screen /usr/share/screen
setup-nsssysinit: /usr/bin/setup-nsssysinit.sh /usr/bin/setup-nsssysinit
setup-nsssysinit: /usr/bin/setup-nsssysinit.sh /usr/bin/setup-nsssysinit
ssh: /usr/bin/ssh /etc/ssh
strings: /usr/bin/strings /usr/include/strings.h
sudo: /usr/bin/sudo /etc/sudo.conf /usr/libexec/sudo
tar: /usr/bin/tar /usr/include/tar.h
time: /usr/bin/time /usr/include/time.h
tracepath: /usr/bin/tracepath /usr/sbin/tracepath
tracepath6: /usr/bin/tracepath6 /usr/sbin/tracepath6
udevadm: /usr/bin/udevadm /usr/sbin/udevadm
updatedb: /usr/bin/updatedb /etc/updatedb.conf
vim: /usr/bin/vim /usr/share/vim
wait: /usr/bin/wait /usr/include/wait.h
yum: /usr/bin/yum /etc/yum /etc/yum.conf

5. whereis -l:输出有效查找路径。

[root@server bin]# whereis -l
bin: /usr/bin
bin: /usr/sbin
bin: /usr/lib
bin: /usr/lib64
bin: /etc
bin: /usr/etc
bin: /usr/games
bin: /usr/local/bin
bin: /usr/local/sbin
bin: /usr/local/etc
bin: /usr/local/lib
bin: /usr/local/games
bin: /usr/include
bin: /usr/local
bin: /usr/libexec
bin: /usr/share
man: /usr/share/man/man7
man: /usr/share/man/cs
man: /usr/share/man/es
man: /usr/share/man/man0p
man: /usr/share/man/zh_CN
man: /usr/share/man/tr
man: /usr/share/man/pl
man: /usr/share/man/fr
man: /usr/share/man/man4x
man: /usr/share/man/id
man: /usr/share/man/man1
man: /usr/share/man/man6x
man: /usr/share/man/man1x
man: /usr/share/man/man7x
man: /usr/share/man/man8x
man: /usr/share/man/man8
man: /usr/share/man/man3
man: /usr/share/man/man6
man: /usr/share/man/pt
man: /usr/share/man/man3p
man: /usr/share/man/man9
man: /usr/share/man/man5x
man: /usr/share/man/de
man: /usr/share/man/nl
man: /usr/share/man/sv
man: /usr/share/man/mann
man: /usr/share/man/zh_TW
man: /usr/share/man/pt_BR
man: /usr/share/man/ru
man: /usr/share/man/ja
man: /usr/share/man/man2x
man: /usr/share/man/man5
man: /usr/share/man/man4
man: /usr/share/man/da
man: /usr/share/man/man3x
man: /usr/share/man/man2
man: /usr/share/man/hu
man: /usr/share/man/ko
man: /usr/share/man/sk
man: /usr/share/man/man1p
man: /usr/share/man/man9x
man: /usr/share/man/it
src: /usr/src/kernels
src: /usr/src/debug
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/219180.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • Java下载文件的几种方式「建议收藏」

    Java下载文件的几种方式「建议收藏」1.以流的方式下载.publicHttpServletResponsedownload(Stringpath,HttpServletResponseresponse){try{//path是指欲下载的文件的路径。Filefile=newFile(path);//取得文件名…

  • pp图与qq图_画图python

    pp图与qq图_画图python统计学中有时会会用到PP图或QQ图

  • 微信小程序后端开发流程_微信小程序开发入门

    微信小程序后端开发流程_微信小程序开发入门微信小程序开发流程记录一、代码处理(一)微信小程序(前端显示)微信小程序项目的架构部分特点说明(二)后台服务器(数据交互)需要的环境特别注意二、项目部署(一)Wampserver的设置(二)域名的获取(三)小程序官方网站上的设置一、代码处理最近一大学同窗开了家自习室,需要一个自习室的预约微信小程序,又恰好手上没有什么代码项目在写,本着少一事不如多一事的原则,尝试了第一次的微信小程序开发。白天要上班,只能利用晚上时间编写,反正他也不着急开业,于是前前后后用了大概半个月的时间,故做记录。刚开始写,确实没什

  • CSS之after clear「建议收藏」

    CSS之after clear「建议收藏」clear属性只会影响使用它的元素,具体可以看我的这篇文章:http://blog.csdn.net/liujan511536/article/details/50086275当我们给一个元素加上:after时,就是在这个元素内容的后面加上新的内容,如: #demo:after { content:”–good” } helloworld

  • mysql好还是oracle好_oracle优缺点

    mysql好还是oracle好_oracle优缺点Oracle与MySQL的区别以及优缺点MySQL的特点1、性能卓越,服务稳定,很少出现异常宕机;2、开放源代码无版本制约,自主性及使用成本低;3、历史悠久,社区和用户非常活跃,遇到问题及时寻求帮助;4、软件体积小,安装使用简单且易于维护,维护成本低;品牌口碑效应;5、支持多种OS,提供多种API接口,支持多种开发语言,对流行的PHP,Java很好的支持MySQL的缺点1、MySQL最大的缺点是其安全系统,主要是复杂而非标准,另外只有到调用mysqladmin来重读用户权限才会发生改变;2

  • 高并发下的nginx性能优化实战

    高并发下的nginx性能优化实战

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号