「Linux」findコマンドで検索したファイルを削除する方法

書式
find ディレクトリ -type f -size サイズ -exec ls -l {} \;

使用例
1.サイズが110M以上のファイルを検索
# find /usr/local/src -type f -size +110M -exec ls -l {} \;
-rw-r–r– 1 root root 196356009 2月 17 11:07 /usr/local/src/solr-8.8.1.tgz

2.検索結果ファイルを削除
# find /usr/local/src -type f -size +110M -exec rm -f {} \;

3.再度確認
# find /usr/local/src -type f -size +110M -exec ls -l {} \;

Linux

Posted by arkgame