Command line arguments limit ARG_MAX, ncargs

The command execution sometimes reports "Argument list too long". For example, mv * or rm * is executed when there are many files in the current directory. This error indicates that the parameters of the executed command are too long and exceed the maximum allowed by the system. This value is controlled by the ARG_MAX parameter.
You can view the value currently set by the system through getconf ARG_MAX.
 
Just ran it on a few machines:
AIX:2097152
VM RHEL5:131072
RHEL6: 2621440
 
Modify the size of ARG_MAX, take AIX as an example:
1. Use the command lsattr -El sys0 -a ncargs to view the bytes occupied by ncargs,
Output result: ncargs 512 ARG/ENV list size in 4K byte blocks True
2. getconf ARG_MAX View the size of the ARG_MAX setting value,
2097152
3. Adjust the bytes occupied by ncargs:
chdev -l sys0 -a ncargs=8 means setting ncargs to occupy 8 bytes,
Increasing this value can modify the setting of the ARG_MAX parameter.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327038066&siteId=291194637