Linux命令搜索命令whereis與which的區(qū)別
一 whereis
1、語法
whereis 命令名
搜索命令所在的路徑以及幫助文檔所在的位置
選項(xiàng):
-b:只查找可執(zhí)行文件
-m:只查找?guī)椭募?/p>
2、實(shí)戰(zhàn)
[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、實(shí)戰(zhàn)
[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環(huán)境變量
定義的是系統(tǒng)搜索命令的路徑
[root@localhost ~]# echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
以上就是Linux命令搜索命令whereis與which的區(qū)別的講解,如有疑問請留言或者到本站社區(qū)交流討論,大家共同進(jìn)步,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選