/bin/rm: Argument list too long

by Josh Highland on December 14, 2007

tux on laptop /bin/rm: Argument list too long

I’m cleaning up my linux web server (the very one that powers this site), and I needed to delete some things that had been accumulation (spam mails). When say mean some, i mean over 100,000 files! I’m not a Linux whiz, but I can manage pretty well.

I tried to remove the files using “rm *”, only to get back “/bin/rm: Argument list too long”
my initial reaction was: wft? Arguments to long?! gtfo!

It took a bit to figure out, but I came up with a solution:

if you try:
rm *

and you get this:
/bin/rm: Argument list too long

do this instead:
find . -name "*" -print | xargs rm

The files are gone, and I am happy once again.

  • digg /bin/rm: Argument list too long
  • facebook /bin/rm: Argument list too long
  • stumbleupon /bin/rm: Argument list too long
  • twitter /bin/rm: Argument list too long
  • delicious /bin/rm: Argument list too long
  • reddit /bin/rm: Argument list too long
  • friendfeed /bin/rm: Argument list too long
  • posterous /bin/rm: Argument list too long
  • tumblr /bin/rm: Argument list too long

Leave a Comment

Previous post:

Next post: