find尋找命令,find尋找

來源:互聯網
上載者:User

find尋找命令,find尋找

find

# 格式 find [路徑] [參數] [運算式] -exec 指令 {} \ ;
-{} 代表find找到的檔案
-\ 禁止轉意 ; 表示本行指令結束
# find /sbin -type f -size +1M -exec ls {} \;
--在/sbin目錄中尋找檔案類型為常規檔案並且檔案大小大於1M,再使用ls命令來查看找到的檔案的類型
# find /sbin -type f -size +1M -exec cp {} /tmp \;

參數:

  -name 按照檔案名稱尋找檔案。
#find / -name "*.conf"

-perm 按照檔案許可權來尋找檔案。
#find / -perm 755 || find /tmp -perm 755 -ls

-user 按照檔案屬主來尋找檔案.
#find / -user student

-group 按照檔案所屬的組來尋找檔案。
#find / -group student

# find / -user vip01 ! -group upl_vip

-newer file1 ! file2 尋找更改時間比檔案file1新但比檔案file2舊的檔案。
#find /home/ -newer kk

-type 尋找某一類型的檔案,諸如:
b- 塊裝置檔案。d - 目錄。c - 字元裝置檔案。 p - 管道檔案。l - 符號連結檔案。f - 普通檔案。
#find /dev/ -type b -ls

-size n:[c] 尋找檔案長度為n塊的檔案,帶有c時表示檔案長度以位元組計。
find /etc/ -size 585c c代表字元 -585c 小於 +566c大於
find /tmp/ -size 2 大於2塊 -2小於2塊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.