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.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s