What can I do about an "argument list too long" error in a shell command or script?

Solution Verified - Updated -


  • When trying to interact with a huge number of files from the command line or a shell script, it fails with an error message:
# ls *.txt
-bash: /bin/ls: Argument list too long
  • Or, when trying to delete a large number of files using find, it fails with an error message:
# find -type f -name '*.txt' -exec rm -i {} \;
-bash: /usr/bin/find: Argument list too long


  • Red Hat Enterprise Linux

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content