Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux 檔案搜尋大全:find 指令從入門到精通

編輯:Linux 教學

每個作業系統都由成千上萬個檔案組成。Windows 下搜尋檔案只需點擊「開始→搜尋」,但在 Linux 透過指令尋找檔案確實較繁瑣。Linux 檔案命名格式複雜,不似 Windows 統一 檔名.副檔名 格式。find 指令是 Linux 管理者必學的強大搜尋工具,也是新手理解 Linux 檔案系統特性的最佳切入點。不同發行版(如 RedHat 7.0 vs 7.1)重要配置檔位置常有變動,不會用 find 根本找不到目標檔案。

一、透過檔名搜尋(-name 參數)

語法直觀易懂:

find / -name httpd.conf
  • /:從根目錄遞迴搜尋
  • -name:指定按檔名搜尋
  • httpd.conf:目標檔名

輸出範例:etc/httpd/conf/httpd.conf 即為完整路徑。若無輸出,可能 Apache 未安裝,安裝後再搜尋即可找到。

進階搜尋技巧預告

本文為系列首篇,後續將介紹:

  • 依檔案大小、時間、權限、擁有者搜尋
  • 結合 -exec、-ok 執行後續動作
  • 正則表達式與通配符進階用法
  • locate/whereis/which 輔助工具比較

掌握 find 指令,不再為茫茫檔案海洋迷失方向。

Copyright © Windows教程網 All Rights Reserved