"ls -al * " not work

Robert P. J. Day rpjday at crashcourse.ca
Fri Nov 23 17:20:20 UTC 2007


On Fri, 23 Nov 2007, Bruno Wolff III wrote:

> On Fri, Nov 23, 2007 at 10:54:37 -0500,
>   chloe K <chloekcy2000 at yahoo.ca> wrote:
> > Hi
> >
> > My ls command not works  properly
> > Are there many files problem?
>
> The argument list was limited to a modest number of files until recently.

i thought this was limited by a hard character limit in the shell, not
just the number of arguments.

> I am not seeing this in cases where I used to on the 2.6.23 kernel.
> There is still a limit, but it is significantly larger than it was
> in the past. So you might still see the problem with 2.6.23 kernels,
> but I wouldn't expect it to happen in typical use.
>
> >
> > [host]# ls -al |wc -l
> > 55264
> >
> > [host]# ls -al *.db |more
> > -bash: /bin/ls: Argument list too long
> >
> > [host]# ls -al *
> > -bash: /bin/ls: Argument list too long
> > [host]# ls -al *.*
> > -bash: /bin/ls: Argument list too long

seems easy enough to find out how hard you can push this:

$ ls -l $(seq 1 100000) 2>&1 | tail -2
ls: cannot access 99999: No such file or directory
ls: cannot access 100000: No such file or directory

$ ls -l $(seq 1 1000000) 2>&1 | tail -2
bash: /bin/ls: Argument list too long

  bisect as necessary.

rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================




More information about the fedora-list mailing list