HowTo: resolve the ‘/bin/rm: Argument list too long’ error

You may of come across this error like us when running the command rm -rf *, fortunately there is a workaround that should help:-

find . -name ‘test-*’ | xargs rm

In the above example the command will forcefully delete all of the files in the current directory that begin with test-. You can replace the parameter test-* with anything you like. You can also use * if you want to simply remove all the files

find . -name ‘*’ | xargs rm

Hopefully by running these commands will help you remove the files you want without getting stuck with the error.

About the Author