linux下whereis和which区别
- 心理
- 关注:4.52K次
Linux命令搜索命令whereis与which的区别
一 whereis
1、语法
whereis 命令名
搜索命令所在的路径以及帮助文档所在的位置
选项:
-b:只查找可执行文件
-m:只查找帮助文件
2、实战
[root@localhost ~]# whereis ls
ls:/usr/bin/ls /usr/share/man/man1/
[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/
二 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/
[root@localhost ~]# which cd
/usr/bin/cd
- 文章版权属于文章作者所有,转载请注明 https://rmnxw.com/lvse/xinli/x647qx.html