Tuesday, June 12, 2012

sudo: unable to execute /bin/rm: Success

I found a weird error message when I tried to delete some files in my linux box today. The command I used was

sudo rm -rf *.js
to delete some .js files, and I got an error message:
sudo: unable to execute /bin/rm: Success
After googling around, I found this wonderful site, and the solution is to use find coupled with -exec flag rather than rm:
sudo find . -iname '*.js' -exec rm {} \;
The problem is, according to the site, was caused by buffer overflow when expanding the *. 
The single quote that we used in the find command will prevent it from expanding and causing overflow.

So, that's all folks.