查詢、壓縮、管道
阿新 • • 發佈:2021-09-28
1、查詢檔案
find命令
在linux系統中,按照我們的要求去查詢檔案。
格式:
find [查詢的路徑] [匹配模式] [匹配規則]
匹配模式:
-name : 按照名字去匹配
正則匹配:
* : 匹配任意數量的任意字元(匹配零個或多個任意字元)
?: 匹配任意一個字元
-type : 按照檔案的型別匹配
常見的檔案型別:
f : 普通檔案
d : 普通資料夾
l : 連結檔案
c : 字元裝置檔案
b : 塊裝置檔案
s : socket檔案
-perm : 按照檔案的許可權來查詢
常見的檔案許可權:
755 : 資料夾的預設許可權
644 : 檔案的預設許可權
-user : 按照檔案的屬主來查詢
-nouser :查詢使用者被刪除了的檔案
-group : 按照檔案的屬組來查詢
-nogroup : 查詢沒有陣列的檔案
知識儲備:
刪除使用者:userdel [使用者名稱]
刪除使用者組:groupdel [屬組名]
-mtime : 按照修改檔案的時間來查詢
+ 查詢某個時間段之前的資料