一.指令格式:
whereis [-bfmsu][-B <目錄>...][-M <目錄>...][-S <目錄>...][檔案...]
回到頂部(go to top) 二.指令功能:
whereis指令是定位可執行檔案、源代碼檔案、幫助檔案在檔案系統中的位置。這些檔案的屬性應屬于原始代碼,二進制檔案,或是幫助檔案。whereis 程式還具有搜尋源代碼、指定備用搜尋路徑和搜尋不尋常項的能力。
如果省略參數,則傳回所有資訊。
三.指令參數:
參數 | 描述 |
---|---|
-b | 定位可執行檔案。 |
-m | 定位幫助檔案。 |
-s | 定位源代碼檔案。 |
-u | 搜尋預設路徑下除可執行檔案、源代碼檔案、幫助檔案以外的其它檔案。 |
-B | 指定搜尋可執行檔案的路徑。 |
-M | 指定搜尋幫助檔案的路徑。 |
-S | 指定搜尋源代碼檔案的路徑。 |
四.使用執行個體:
1:檢視指令"bash"的位置
指令:
whereis bash
輸出:
hc@hc-virtual-machine:~$ whereis bash
bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz
說明:
以上輸出資訊從左至右分别為查詢的程式名、bash路徑、bash的man 手冊頁路徑。
2:顯示bash 指令的二進制程式的位址
whereis -b bash
hc@hc-virtual-machine:~$ whereis -b bash
bash: /bin/bash /etc/bash.bashrc
3.顯示bash指令的幫助檔案位址
whereis -m bash
hc@hc-virtual-machine:~$ whereis -m bash
bash: /usr/share/man/man1/bash.1.gz