What can I do about an "argument list too long" error in a shell command or script?
Issue
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
Environment
- Red Hat Enterprise Linux
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
