fedora 11 bash maximum line length?

Cameron Simpson cs at zip.com.au
Mon Jul 20 08:46:17 UTC 2009


On 20Jul2009 01:50, Frank Cox <theatre at sasktel.net> wrote:
| What is the maximum length of a command line in bash on Fedora 11?
| 
| [frankcox at mutt ~]$ getconf ARG_MAX
| 2621440
| 
| Does this mean that I can enter over 2 million characters on a single bash
| command line?

Probably not - you can probably do more. (Actual answer at the bottom of
this message.)

Bash it self doesn't have a command line limit AFAIK; the shells
will all allow you to enter lines as long as you like subject to
available memory.

It was the case that ARG_MAX limited the total size of program arguments
plus environment strings, but recent linux kernals have made that
dynamic; not unlimited, sadly, but much much larger than it was; I
forget the criteria.

The result of this is that on a Linux system it is now much less likely
that users will hit the command line limit. However, there still is one,
so while users get more and more careless the number of scripts that can
break slowly grows.

On the other hand, it may contribute to making xargs a much less used
command, and that is generally good, since I routinely see it misused in
scripts by people who don't understand what it does and why it exists.
Seriously, I've seen it shoved into the middle of pipelines "just
because":-(

Anyway, "man 2 execve" ought to answer this question. And indeed,
I see it has a secion entitled "Limits on size of arguments and
environment" which talks about ARG_MAX and how that doesn't apply from
kernels 2.6.23 onwards.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

They call me a bummer and a gin-sop,too....but what care I for praise!
        - Bob Dylan.   "The days of '49"




More information about the fedora-list mailing list