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

Re: Unix 101: ls with file count




Chain commands in an alias:

alias dols="ls; echo `ls -l | grep ^d | wc -l` directories; echo `ls -l | grep ^- | wc -l` files"

customize as needed


Thus spake Kent West (westk@acu.edu):

> Date: Mon, 24 Jun 2002 22:41:48 -0500
> From: Kent West <westk@acu.edu>
> To: Debian-User List <debian-user@lists.debian.org>
> Subject: Unix 101: ls with file count
> X-Mailing-List: <debian-user@lists.debian.org> archive/latest/218576
> 
> Okay, back to Unix 101 for me.
> 
> How do I produce a directory listing followed by a count of files and 
> directories?
> 
> ls | wc
> 
> only produces a count without listing the files, and it doesn't 
> distinguish between files and directories. What I'd like is something 
> like this:
> 
> westk03[westk]:/home/westk> ls
> DOCS          evolution
> Desktop       lang
> HOCHZEIT.MPG  lynx_bookmarks.html
> INSTALLERS    mbox
> MMEDIA        mnt
> Mail          nsmail
> Nautilus      oh brother where art thou - down by the river allison kra.wav
> PILOT         plugin130_01.trace
> bin           progtool
> calc.perl     tmp
> clock         vmware
> doc           www
> 
> 16 directories
> 8 files
> --------
> 24 total
> 
> Thanks!
> 
> Kent
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact 
> listmaster@lists.debian.org



:wq!
---------------------------------------------------------------------------
Robert L. Harris                
                               
DISCLAIMER:
      These are MY OPINIONS ALONE.  I speak for no-one else.
FYI:
 perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: