前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Linux命令搜索命令whereis与which的区别

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

作者头像
砸漏
发布2020-10-19 10:55:14
1.2K0
发布2020-10-19 10:55:14
举报
文章被收录于专栏:恩蓝脚本恩蓝脚本

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的区别的讲解,如有疑问请留言或者到本站社区交流讨论,大家共同进步,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-09-11 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档