find工具 查找文件或目錄

find工具ide

ufind工具用於查找文件或目錄,根據預設的條件遞歸查找對應的文件工具

——命令格式:find  目錄  條件1  選項  條件2   …遞歸

——經常使用條件文檔

u-type  類型(f文件  d目錄   l快捷方式) u-name  「文檔名」 u-iname  按名稱查找忽略大小寫 u-size  文件大小(k、M、G) u-user  用戶名 u-mtime  按日期查找(+ 表明多少天以前   - 表明多少天以內)it

— find /root/ -mtime  +10     //10天以前class

— find /root/ -mtime  -10      //10天以內im


ufind命令提供了一個單獨的處理結果命令 –exec移動

——命令格式:find ..  ..  -exec  處理命令   {}    \;di

u以 {} 代替每個結果,逐個處理,遇 \;結束 ufind /var/log/ -mtime +10 -type f -exec cp {} /opt/ \;      #拷貝 ufind /var/log/ -mtime +10 -type f -exec mv {} /opt/ \;  #移動 ufind /var/log/ -mtime +10 -type f -exec rm {}  \;  #刪除文件

相關文章
相關標籤/搜索