What is the maximum character length of arguments in a shell command? How do I find out the maximum length of arguments for a new process under Linux or Unix like operating systems?
If you get an error that read as - command: Argument list too long due to limit for the command line length.
$ getconf ARG_MAX
The following bash code will provide you exact number:
echo $(( $(getconf ARG_MAX) - $(env | wc -c) ))
POSIX suggests to subtract 2048 additionally so that the process may savely modify its environment:
expr `getconf ARG_MAX` - `env|wc -c` - `env|wc -l` \* 4 - 2048
Please note that the maximum length of arguments for a new process may differ among unix flavours. I recommend that you go through this web page for detailed information.Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?