linux系列(十七):whereis命令


1、命令格式:

  whereis [-bmsu] [BMS 目錄名 -f ] 文件名

2、命令功能:

whereis命令是定位可執行文件、源代碼文件、幫助文件在文件系統中的位置。這些文件的屬性應屬於原始代碼,二進制文件,或是幫助文件。whereis 程序還具有搜索源代碼、指定備用搜索路徑和搜索不尋常項的能力。

3、命令參數:

-b   定位可執行文件。
-m   定位幫助文件。
-s   定位源代碼文件。
-u   搜索默認路徑下除可執行文件、源代碼文件、幫助文件以外的其它文件。
-B   指定搜索可執行文件的路徑。
-M   指定搜索幫助文件的路徑。
-S   指定搜索源代碼文件的路徑。

4、簡單實例:

(1)、將和某文件相關的文件都查找出來

felix@felix-computer:~$ whereis git
git: /usr/bin/git /usr/share/man/man1/git.1.gz
felix@felix-computer:~$ whereis python
python: /usr/bin/python3.6 /usr/bin/python3.6m /usr/bin/python3.6m-config /usr/bin/python /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python3.6-config /usr/lib/python3.7 /usr/lib/python3.6 /usr/lib/python2.7 /etc/python3.6 /etc/python /etc/python2.7 /usr/local/lib/python3.6 /usr/local/lib/python2.7 /usr/include/python3.6 /usr/include/python3.6m /usr/include/python2.7 /usr/include/python3.6dm /usr/share/python /usr/share/man/man1/python.1.gz
felix@felix-computer:~$ 

(2)、-b  -m  -s的應用

felix@felix-computer:~$ whereis -b git
git: /usr/bin/git
felix@felix-computer:~$ whereis -m git
git: /usr/share/man/man1/git.1.gz
felix@felix-computer:~$ whereis -s git
git:
felix@felix-computer:~$ 


說明:-b : 只將二進制文件查找出來
   -m : 查出說明文檔路徑
   -s :找到source源文件

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM