这篇文章主要介绍了linux命令搜索命令whereis与which的区别的相关资料,这里举例说明该如何区别他们之家的用法,需要的朋友可以参考下
Linux命令搜索命令whereis与which的区别
一 whereis
1、语法
whereis 命令名
搜索命令所在的路径以及帮助文档所在的位置
选项:
-b:只查找可执行文件
-m:只查找帮助文件
2、实战
[root@localhost ~]# whereis lsls:/usr/bin/ls /usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz[root@localhost ~]# whoamiroot[root@localhost ~]# whatiswhatis what?[root@localhost ~]# whatis lsls (1)- list directory contentsls (1p)- list directory contents[root@localhost ~]# whereis -b lsls:/usr/bin/ls[root@localhost ~]# whereis -m lsls:/usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz
登录后复制
二 which
1、语法
which 命令名
搜索命令所在路径及别名
2、实战
[root@localhost ~]# which lsalias ls='ls --color=auto'/usr/bin/ls[root@localhost ~]# which pwd/usr/bin/pwd[root@localhost ~]# whereis cdcd:/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的区别的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/3165343.html