Bash: argument list too long

by Wolfram Saringer  (2014-04-07)
last change: 2014-04-07

That moment of truth when you want to clean out a filled up directory and bash reassuringly tells you:

/bin/rm: cannot execute [Argument list too long]

Use find and xargs:
find . -name "*.log" -print0 | xargs -0 rm

but beware that this works recursively. Try "-maxdepth 1" to limit to the current directory.

all articles represent the sole opinion of their respective author. all content comes without any warranty for correctnes, despite due diligence.