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的區別的講解,如有疑問請留言或者到本站社區交流討論,大家共同進步,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答