linux下刪除大量小文件

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]*



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章