シェルコマンドまたはスクリプトに出力された argument list too long エラーはどのように対処すれば良いですか?

Solution Verified - Updated -

Issue

コマンドラインまたはシェルスクリプトから大量のファイルを処理するとエラーが発生し、以下のメッセージが発生します。

# ls *.txt
-bash:/bin/ls:Argument list too long

または、find を実行して大量のファイルを削除しようとすると、エラーメッセージが発生します。

# 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.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.