Linux ‘/bin/rm: Argument list too long’ error

Have you ever encountered this error in Linux when you have a directory that has too many files and you are unable to delete them with  rm -rf *? I first ran into this issue when I had an Oracle database server that had too many log files in the crs log directory. After a little bit of searching I found this solution.

find . -name "*.log" -print | xargs rm

This command will delete all files in the current directory that have the extension log.

Xargs is Linux command that makes passing a number of arguments to a command easier.

Leave a comment