Listing *only* directories?

Peter Hiscocks phiscock-g851W1bGYuGnS0EtXVNi6w at public.gmane.org
Tue Jan 13 04:49:01 UTC 2004


Inspired by David Tilbrook's comments on linux, I ask you to consider the
following:

Amazingly, although 'ls' appears to have a zillion options, such as the
somewhat obscure:

       -b, --escape
              print octal escapes for nongraphic characters

there appears to be no way to do a directory list of *only* the
subdirectories.

My hopes were raised by ls -d:

       -d, --directory
              list directory entries instead of contents

Alas, it's behaviour is illustrated by the following dialogue:
-----------------------------------
[phiscock-YIGruI5hBFo at public.gmane.org visual-vocab]$ ls -d
.
-----------------------------------
In other words, this tells you that you are in the current directory! Wow.

When you have a directory full of files (there are over 300 of them in the
project directory I'm working on) and you can't colourize entries
because you're on a monochrome dial-in terminal, identifying the
subdirectories is really difficult. (And since monochrome terminals were the
norm back in the Dawn of Unix, you'd think this option would have have been
added.)

Any suggestions from the Great Collective Mind for a nice alias or
workaround to obtain this function?

Thanks -
Peter

P.S. I'm also curious why ls -d would be useful. Presumably, there is more
to it that meets the eye.

P.
-- 
Peter D. Hiscocks                         	   
Department of Electrical and Computer Engineering    
Ryerson University,                    
350 Victoria Street,
Toronto, Ontario, M5B 2K3, Canada

Phone:   (416) 979-5000 Ext 6109
Fax:     (416) 979-5280
Email:   phiscock-g851W1bGYuGnS0EtXVNi6w at public.gmane.org
URL:     http://www.ee.ryerson.ca/~phiscock
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list