/bin/rm: Argument list too long

You type: rm * -f
You get: /bin/rm: Argument list too long
Reason: in shell when you do * after rm and get Argument list too long, your shell actually expands that * and puts all the filenames after rm and since length of the command line is limited, you end up getting argument list too long.

Possible solutions:

  1. You can remove the whole directory and recreate the directory
  2. When 1 is not an option, you can you “find” to delete for you. I actually use this method more often then removing/creating directory.
    find . -exec rm {} \; This will delete everything in current directory on. Be careful with this command since you could potentially delete things you may not wanted to. I suggest running find . |more first to see what will be affected.  To read more about find see:  man find

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.


One Response to “ /bin/rm: Argument list too long ”

  1. July 27th, 2008 | 4:41 am

    [...] La solución que más me ha convencido y que al final he acabado utilizando ha sido la que puede encontrarse en esta página. [...]

Leave a reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image