
xargsを使用して、使用しているコマンドラインの制限を確認できます。
$ xargs --show-limits
Your environment variables take up 1901 bytes
POSIX upper limit on argument length (this system): 2093203
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2091302
Size of command buffer we are actually using: 131072
Maximum length of command we could actually use
しかし、私はSize of command buffer we are actually using
。これら2つの制限は何を意味し、コマンドラインの長さの実際の制限は何ですか?
答え1
「現実的に利用可能な最大コマンド長」は、xargs
実行中のプラットフォームと環境が占めるスペースの制限を考慮すると、可能な最大コマンドライン長です。この値は、プラットフォームの構成と環境によってのみ異なります。 「実際に使用するコマンドバッファのサイズ」は、この呼び出しxargs
で使用されるサイズです。最大値より大きくすることはできませんが、最大値より小さくすることはできます。デフォルトではxargs
最大値は使用されませんが、代わりに「合理的な」デフォルトコンパイル時に決定され、プラットフォームの制限(通常128kB)によって制限されます。使用される実際のサイズはオプションで変更できます-s
。