linux命令xargs:它传递的参数的最大大小? [英] linux command xargs: maximum size of the arguments passed by it?

查看:1057
本文介绍了linux命令xargs:它传递的参数的最大大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎xargs没有一次通过所有的参数,在手册中说xargs 执行命令(默认是/ bin / echo)一次或多次,我听说这样做的原因是,xargs将传入的参数剁成组并将它们按组传递给命令组。如果这是正确的,任何人都知道如何确定这个组大小?感谢

It seems that xargs doesn't pass all the arguments at once, in says in the manual that xargs executes the command (default is /bin/echo) one or more times, I heard that the reason for this is that xargs chops the passed in arguments into groups and pass them to the command group by group. If this is correct, anyone knows how this group size is determined? Thanks

推荐答案

使用 - show-limits 参数。它将列出您系统上的现有限制。

Use the --show-limits argument. It will list the existing limits on your system.

$ xargs --show-limits
Your environment variables take up 4108 bytes
POSIX upper limit on argument length (this system): 2090996
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2086888
Size of command buffer we are actually using: 131072

组大小取决于长度

xargs 手册页,供参考:


POSIX标准允许实现对exec函数的参数大小有限制。此限制可以低至4096字节,包括环境的大小。对于可移植的脚本,它们不能依赖于更大的值。但是,我知道没有实现的实际限制是小。 --show-limits选项可用于发现当前系统上的实际限制。

The POSIX standard allows implementations to have a limit on the size of arguments to the exec functions. This limit could be as low as 4096 bytes including the size of the environment. For scripts to be portable, they must not rely on a larger value. However, I know of no implementation whose actual limit is that small. The --show-limits option can be used to discover the actual limits in force on the current system.

这篇关于linux命令xargs:它传递的参数的最大大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆