How would one go about determining the amount of space allocated to their system for command lines. Is there anything else I need to be concerned with?
How does one determine the amount of space allocated to their command line?
linux;shell;command;limit
xargsOne method that I'm aware of is to use xargs to find this information out.$ xargs --show-limits --no-run-if-empty < /dev/null Your environment variables take up 4791 bytesPOSIX upper limit on argument length (this system): 2090313POSIX smallest allowable upper limit on argument length (all systems): 4096Maximum length of command we could actually use: 2085522Size of command buffer we are actually using: 131072getconfThe limit that xargs is displaying derives from this system configuration value.$ getconf ARG_MAX2097152Values such as these are typically hard coded on a system. See man sysconf for more on these types of values. I believe these types of values are accessible inside a C application, for example:#include <unistd.h>...printf(%ld\n, sysconf(_SC_ARG_MAX));ReferencesARG_MAX, maximum length of arguments for a new process