linux 檔案搜尋

which,whereis,locate,find,type
updatedb 用於更新資料庫

which 在 PATH 中尋找執行檔
-a 列出所有,而不是第一個
whereis 在資料庫中查找,比 find 操作速度快 
-b 找二進制文件
-m 只找說明檔 manual 路徑下的檔案,找幫助文檔
-s 只找 source 來源檔案 
-u 找除上面三個地方的文件
locate  -ir 最大的作用是 -r 後可接正則表達式 
-i 忽略大小寫

find [path] [option] [action]
-size [+-] size 
    size 規格有 c(byte),k(kb)
-name filename
-type type
    type 有 f(一般正規檔案),d(目錄),l(連接檔)
-user username 
-group groupname
-nouser 查找在 /etc/passwd 中找不到的用戶
-nogroup 查找在 /etc/group 中找不到的組
-newer file 比 file 還要新的檔案
-perm -mode 搜尋檔案權限必須要全部囊括 mode 的權限 -perm -0744 4755權限的文件也會列出,因爲4755已經全部包含了 0744 的權限
-perm +mode 搜尋檔案權限包含任一 mode 的權限 -perm +755 時,600 也會列出,因爲 600 爲 rw 在 755 爲 rwxr-xr-x 內 

-exec commond 對找到的結果集執行命令,結果集在 {} 中,後面要加上分號即 \;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章