whereis#

whereis 是包含在 util-linux 軟體包的一部分

Install#

$ sudo apt install util-linux

Operate#

與 which 僅搜尋 $PATH 變數不同,whereis 會搜尋系統中一組固定的標準目錄。 這些目錄通常包括:

  • /bin, /sbin, /usr/bin, /usr/sbin (執行檔)
  • /usr/share/man (說明文件)
  • /usr/src (原始碼)
operationdescriptionexample
-b只搜尋執行檔whereis -b ls
-m只搜尋說明文件whereis -m ls
-s只搜尋原始碼whereis -s ls
-u顯示未分類的檔案whereis -u ls
-B <path>指定搜尋執行檔的目錄whereis -B /custom/bin ls
-M <path>指定搜尋說明文件的目錄whereis -M /custom/man ls
-S <path>指定搜尋原始碼的目錄whereis -S /custom/src ls

Reference#

Official docs: