Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • So ARG_MAX is actually a character count for the whole command line, or is it rather a buffer size? How does character encoding play into this? Commented Jun 24, 2018 at 8:21
  • 2
    @dessert ARG_MAX is the number of bytes that the combined length of the environment and the command argument list, including the command name and any null terminators on each argument (and on environment variable names/values), can be. So multi-byte characters would take more space. It may be a kernel or library buffer size. Commented Jun 24, 2018 at 8:28
  • @dessert Unquoted whitespace between the command's arguments would not count, so it's not the length of the command line. Commented Jun 24, 2018 at 8:29
  • 2
    @Kusalananda, I've understood it's the limit on the argument string size, it's discussed in the linked question. E.g. this would trigger it: /bin/echo $( perl -e 'print "x" x $ARGV[0]' 131072 ) > /dev/null (one less works). I think PATH_MAX is usually 4096 (again, on Linux), and I don't think it's related. Commented Jun 24, 2018 at 20:14
  • 1
    @ilkkachu Thanks for pointing this out. That limit does not seem to be an issue on OpenBSD, but I'll find a Linux system somewhere and may update the answer when I have time. Commented Jun 24, 2018 at 20:23