[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls -l|head seems to look at all files in directory

From: Jim Meyering
Subject: Re: ls -l|head seems to look at all files in directory
Date: Mon, 25 May 2009 21:46:01 +0200

Bob Proulx wrote:

> Jim Meyering wrote:
>> Right.  The change that made ls -1U more efficient was after 6.12
>> [v6.12-113-g8d974b0]:
>> commit 8d974b00fbbc2025de63e1e6d54827648fefa1c4
>> Author: Kamil Dudka <address@hidden>
>> Date:   Wed Jul 30 14:31:50 2008 +0200
>>     ls -U1 now uses constant memory
>>     When printing one name per line and not sorting, ls now uses
>>     constant memory per directory, no matter how many files are in
>>     the directory.
>>     * ls.c (print_dir): Print each file name immediately, when possible.
>>     * NEWS: Mention the improvement.
> Hmm...  Traditionally hasn't output to a pipe been the same as -1?  So
> it seems to me that 'ls -U | cat' should be the same as 'ls -1U | cat',
> shouldn't it?  This makes me wonder why the -1 is needed for this
> behavior.  It would seem that output to a pipe should be enough.

Hi Bob,

Good point.  The -1 is not needed when ls' stdout is a pipe.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]