Fix: "bash: /bin/rm: Argument list too long"

Attempting to delete a large list of files may error with "Argument list too long".

$ rm *.log.*.gz
bash: /bin/rm: Argument list too long

The solution is to use the find command and pass the -delete option.

$ find -name "*.log.*.gz" -delete

Find the maximum number of arguments allowed:

$ getconf ARG_MAX
262144
View this page on GitHub.
Posted .

Comments

Leave a Reply