coreutils
[Top][All Lists]
Advanced

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

Re: ls to show the number of items in directories?


From: Bernhard Voelker
Subject: Re: ls to show the number of items in directories?
Date: Tue, 9 Jan 2018 08:05:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 01/01/2018 11:55 PM, Tony Freeman wrote:
I've been perusing the man page for 'ls' and not finding what I'm looking
for.  Perhaps I've skipped over it?

I'm looking for a 'ls' option that will list the directory along with the
number of items inside that directory.  For instance:

ls -1 --content-count

  4 inhumans.2000
12 inhumans.2003
  4 inhumans.2013.inhumanity
16 inhumans.2014
  5 inhumans.2015
21 inhumans.2015.uncanny
  6 inhumans.2016.vs.x.men
  5 inhumans.2017.once.and.future.kings
  1 inhumans.prime.001.cbz

Is there such an option to ls?

I'm afraid not.  Probably you have coreutils >= v8.22, so you could
try du's --inodes option:

  $ du --inodes -d1
  9684  ./gnulib
  974   ./src
  2611  ./gnulib-tests
  622   ./.git
  1896  ./lib
  8     ./autom4te.cache
  7     ./scripts
  59    ./gl
  236   ./po
  449   ./m4
  29    ./build-aux
  219   ./man
  2012  ./tests
  655   ./m
  4055  ./doc
  3     ./.github
  23563 .

Have a nice day,
Berny



reply via email to

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