Ubuntu(linux)的终端命令行的命令长度是否有限制?如何修改shell命令长度限制?

Ubuntu(linux)的终端命令行的命令长度是否有限制?如何修改shell命令长度限制?

喜欢这个问题 | 分享 | 新建回答

回答

肥猿

May 5, 2022
1 赞

命令行输入“xargs --show-limits”即可显示,示例如下:

$ xargs --show-limits
Your environment variables take up 1007 bytes
POSIX upper limit on argument length (this system): 2094097
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2093090
Size of command buffer we are actually using: 131072
Maximum parallelism (--max-procs must be no greater): 2147483647
Execution of xargs will continue now, and it will try to read its input and run commands; if this is not what you wanted to happen, please type the end-of-file keystroke.
Warning: echo will be run at least once.  If you do not want that to happen, then press the interrupt keystroke.

因此,Ubuntu命令行最大的长度是2093090。