Heri • March 20th, 2007 • 1 comment

/bin/rm: argument list too long

At “MadMedia“, we handle a website that gets around 300k unique visitors monthly. The website is operated with Ruby on Rails, has social networking and voting features, and sessions are stored on hard disk. User sessions are not that big, we store hashes and all the usual stuff but after a while, you need to clean it up.

Now I was puzzled by rm this afternoon
rm -f * in /tmp/sessions directory. The terminal choked and gave out

-bash: /bin/rm: Argument list too long

Apparently there are a maximum number of files that can be passed to rm
ls -1 | grep ruby | wc -l


382611

gulp! 382 611 session files! Imagine that the application has to cycle through all of them every time (yeah, we implemented a _refresh_user_from_cookie_ method for every user logging in) Now, no wonder why logging took so much time!

The solution, by the way is:


find . -name 'ruby*' | xargs rm

Everything is smooth now, even though I am looking forward to “memcache-client“.

One response to “/bin/rm: argument list too long”

  1. migraine says:

    Migraine is een bonzende hoofdpijn die meestal voorkomt aan één kant van de schedel. De pijn is heftig en houdt 4 tot 72 uur aan.

Leave a Reply

Categories

from heri.tumblr.com



Photos

samedi samedi samedi samedi soirée samedisoirée samedisoirée samedisoirée samediSénégalun soir d'été

See more pictures

Heri is also at

Heri does not use Instant Messenging or other communications means that disrupts workflows.


© 2007 2008 Heri Rakotomalala
Photographs and Screenshots are under Creative Commons. Attribution-NonCommercial-ShareAlike 2.0
Screenshots, logos, videos, and trademarks showcased on this blog are the property of their respective owners.