/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.

2 thoughts on “/bin/rm: Argument list too long

  1. Pingback: Consejos para utilizar el comando rm de Linux con múltiples parámetros | Mareos de un Geek

Leave a Reply

Your email address will not be published. Required fields are marked *