zsh-workers
 help / color / mirror / code / Atom feed
From: Manfred Lotz <manfred.lotz@arcor.de>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Length of argument list
Date: Thu, 11 Jun 2015 11:23:47 +0200	[thread overview]
Message-ID: <20150611112347.70a70d7b@hogwart.bsdlocal.net> (raw)
In-Reply-To: <CAHYJk3R4pCYWths7g=Mfd+xDBAdxetHSusCyvq6P5KFrsd4DuQ@mail.gmail.com>

On Wed, 10 Jun 2015 22:09:06 +0200
Mikael Magnusson <mikachu@gmail.com> wrote:

> On Wed, Jun 10, 2015 at 8:48 PM, Manfred Lotz <manfred.lotz@arcor.de>
> wrote:
> > Hi all,
> > I created 1 million files in a directory callend manyfiles/.
> >
> > Now
> > ls manyfiles/* |wc -l
> >
> > gives
> > zsh: argument list too long: ls
> >
> >
> > Question: Is there a way to change the maximum size of the argument
> > list?
> 
> That depends on your operating system, on linux it is guided by ulimit
> -s (in particular, the argument list is a quarter of the stack size).

Interesting. Didn't know. This works indeed.

Do you know how it is in FreeBSD, for instance?

> On other operating systems, the limit is traditionally quite small.
> I'm assuming the above is just an example, but that particular thing

Yes, just an example. I want to see if it possible to use simple
command when dealing with directories containing many files.


> would be better handled by () { echo $# } manyfiles/*, or some
> xargs/zargs contraption if you want to be more general.
> 

..and for f in *... and things like this.


In the end it means if a directory contains a large number of files
then the usual commands rm, cp, mv etc cannot be used easily without
additional support (find,xargs, for loops etc).

-- 
Manfred






  reply	other threads:[~2015-06-11  9:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 18:48 Manfred Lotz
2015-06-10 20:09 ` Mikael Magnusson
2015-06-11  9:23   ` Manfred Lotz [this message]
2015-06-10 21:46 ` Clint Hepner
2015-06-11  9:27   ` Manfred Lotz
2015-06-11 13:20     ` Stephane Chazelas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150611112347.70a70d7b@hogwart.bsdlocal.net \
    --to=manfred.lotz@arcor.de \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).