Home > Linux > Bypass rm's “argument list too long” error message with xargs

Bypass rm's “argument list too long” error message with xargs

When using rm to delete a large number of files, you may come up against a kernel limitation which limits the length of arguments that can be sent to rm:

$ rm *

bash: /bin/rm: Argument list too long

This one-liner utilizes xargs to bypass this limitation:

ls | xargs rm

Categories: Linux
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.