温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Linux中whereis与which的区别是什么

发布时间:2021-01-28 10:08:31 来源:亿速云 阅读:302 作者:Leah 栏目:服务器

Linux中whereis与which的区别是什么?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

Linux命令搜索命令whereis与which的区别

一 whereis

1、语法

whereis 命令名

搜索命令所在的路径以及帮助文档所在的位置

选项:

-b:只查找可执行文件
-m:只查找帮助文件

2、实战

[root@localhost ~]# whereis ls
ls:/usr/bin/ls /usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz
[root@localhost ~]# whoami
root
[root@localhost ~]# whatis
whatis what?
[root@localhost ~]# whatis ls
ls (1)- list directory contents
ls (1p)- list directory contents
[root@localhost ~]# whereis -b ls
ls:/usr/bin/ls
[root@localhost ~]# whereis -m ls
ls:/usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz

二 which

1、语法

which 命令名

搜索命令所在路径及别名

2、实战

[root@localhost ~]# which ls
alias ls='ls --color=auto'
/usr/bin/ls
[root@localhost ~]# which pwd
/usr/bin/pwd
[root@localhost ~]# whereis cd
cd:/usr/bin/cd /usr/share/man/man1/cd.1.gz/usr/share/man/man1p/cd.1p.gz
[root@localhost ~]# which cd
/usr/bin/cd

三 PATH环境变量

定义的是系统搜索命令的路径

[root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

关于Linux中whereis与which的区别是什么问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注亿速云行业资讯频道了解更多相关知识。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI