Linux: how much data can be passed as command line arguments?

How many bytes can be sent as a command line argument when spawning a process on Linux?

+2
source share
3 answers

gahooa offers a good article at http://www.in-ulm.de/~mascheck/various/argmax/ , but if this page disappears someday, here's the deal: find the Maximum length of command line arguments trying to do one of the following

* command: getconf ARG_MAX * system call: sysconf(_SC_ARG_MAX) * system header: ARG_MAX in eg <[sys/]limits.h> 
+4
source

A good article describes the problem:

http://www.in-ulm.de/~mascheck/various/argmax/

+6
source

This snippet will tell you.

 #include <stdio.h> #include <unistd.h> int main(int argc, char** argv) { const long value = sysconf(_SC_ARG_MAX); printf("ARG_MAX: %ld\n", value); } 
+4
source

All Articles