Linux中的 find、locate、whereis、which、whatis
阿新 • • 發佈:2018-11-19
- find,從指定路徑開始搜尋檔案
# 例,更多用法參照 man
find <路徑> -name <檔名>
# -type f 普通檔案
# -type d 資料夾
# -type p 管道檔案
# -type s socket檔案
# -iname <檔名> 大小寫不敏感
# -mtime 2 之前2~3這一天修改過的檔案
# -atime +1 兩天前被訪問過的檔案
- locate,從資料庫(/var/lib/mlocate/)搜素檔案資訊,該資料庫包含了Linux系統的所有檔案資訊,每晚自動更新(可手動更新 updatedb)
# 例
locate <檔名>
- whereis,與locate搜尋方式一致,只搜尋二進位制檔案、man說明檔案、原始碼檔案
# 例
whereis <檔名>
# -b 二進位制檔案
# -m man說明檔案
# -s 原始碼檔案
- which,在PATH路徑中搜索可執行檔案路徑
# 例
which <命令名>
- whatis,顯示man手冊中對命令的一行描述
# 例
whatis <命令名>
~別忘了全知的man