Re: ls -l|head seems to look at all files in directory
From:
Dr. David Alan Gilbert
Subject:
Re: ls -l|head seems to look at all files in directory
Date:
Mon, 25 May 2009 16:26:03 +0100
User-agent:
Mutt/1.5.13 (2006-08-11)
* Reuben Thomas (address@hidden) wrote:
> On Mon, 25 May 2009, Jim Meyering wrote:
>
> >To do what he wants you have to know that ls -1U is the only
> >way to get one output entry per readdir call.
> >
> >Reuben, you want to do it like this:
> >
> > ls -1U|head|xargs ls -l
>
> Thanks for the hint about -1, but this doesn't seem to make any difference:
> I run "ls -1U|head" in a directory with lots of files (about 10,000) and it
> pauses for a minute or so before giving me my ten lines of output.
>
> If I run the command again, then of course it runs almost instantly, so I'm
> not sure what use the loops are in the tests you give.
Are all the files just normal files - or are any symlinks to other
directories or mount points?
Dave
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \
\ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/