linux find命令筆記(參考鳥哥第三版)

來源:互聯網
上載者:User


linux find命令筆記(參考鳥哥第三版) find [PATH] [option] [action] 或者find PATH OPTION [-exec COMMAND { } \; 1. 時間有關選項:共有 -atime, -ctime 不 -mtime ,以 -mtime 說明 -mtime n :n 為數字,意義為在 n 天前『一天內』被更勱過內容的檔案;  www.2cto.com  -mtime +n :列出在 n 天前(不含 n 天本身)被更改過內容的檔案檔名; -mtime -n :列出在 n 天內(含 n 天本身)被更改過內容的檔案檔名。 -newer file :file 為一個存在的檔案,列出比 file 還要新的檔案檔名 Find / -mtime 0 0表示現在開始到24小時前   2 使用者或者組名: -uid n :n 為數字,這個數字是使用者癿帳號 ID,就是UID ,這個 UID 是記在 /etc/passwd 裡面不帳號名稱對應的數字。 -gid n  :n也是數字,代表組名的id就是GID -user  name:  name使用的帳號名 -group name:name 組名 -nouser ,-nogroup 不熟悉的使用者和組的  www.2cto.com  3.檔案名,檔案屬性有關 -name filename:搜尋檔案名稱為filename的文檔 -size [+-]number : 大小規格c表示byte,k表示1024bytes -type :搜尋檔案類型一般檔案f,裝置b和c ,目錄d ,、socket是c -perm mode 搜尋檔案許可權 4 額外可進行的動作  www.2cto.com  -print :將搜尋後的結構列印到當前螢幕上 -exec do:這個do就是你要執行的命令,比如將name是world的檔案夾後再判斷檔案類型 操作:find / -name "world" -type d -exec file {} \; 結構 :/tmp/world: directory {} 內的就是find / -name "world" -type d -exec 一直到 \; 是關鍵詞,代表 find 額外開始 (-exec) 到結束 (\;)
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.