Web lists-archives.com

Re: question about ls




On Thu 27 Sep 2018 at 07:55:56 (-0500), Kent West wrote:
> On Tue, Sep 25, 2018 at 6:14 PM Ben Caradoc-Davies <ben@xxxxxxxxxxxx> wrote:
> 
> > On 26/09/2018 10:55, Long Wind wrote:
> > > sorry! you're right.
> > > after checking ls manual, i find ls has option -1
> >
> > Note also that ls will behave like it has the "-1" option if its output
> > is piped to another command, even without this option. I like to use the
> > "-1" option even in this case because it is what I mean (counting
> > entries one per line).
> >
> >
> But also note the difference when using the letter "l" vs the numeral "1":
> 
> westk@westkbox:/opt$ ls -la | wc
>      7      56     321
> westk@westkbox:/opt$ ls -1a | wc
>      6       6      54
> 
> The difference is that the letter includes the total count of blocks used
> at the top of the list (adding one to the count), whereas the numeral does
> not.

But do use 1A, not 1a, if you want to know how many items are
in a folder, otherwise . and .. will be included in the count.

Cheers,
David.