Intro.

Say you have a LINUX dir full of thousands of insignificant small files, like a dir full of mail messages that you want to clean fast.

You are 100% sure you can delete all of those small pesky files without consequences for anyone, because they are just uninformative messages (say you were monitoring your devices and you’ve put your host down for maintenance).

Issue.

This is what happens when you try to delete this huge files list:

root@srvr008 [/home/user/mail/domain.com/hostmaster/cur]# rm -rf *
-bash: /bin/rm: Argument list too long

Fix.

To successfully remove them, use instead:

ls | xargs rm

Rate this post