1、Linux下怎麼刪除大量的小文件或者以數字開頭的小文件?
解答:
模擬環境,在/tmp目錄下創建1000000個小文件
cd /tmp && touch {1..1000000}
方法1:
[root@localhost tmp]# ls|egrep "^[0-9]*"|xargs ls -l
方法2:
[root@localhost tmp]# find /tmp -type f -name "[0-9]*"|xargs rm -f
方法3:
[root@localhost tmp]# rm -f [0-9]*