這篇文章主要介紹了linux命令搜索命令whereis與which的區別的相關資料,這里舉例說明該如何區別他們之家的用法,需要的朋友可以參考下
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
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END