Listing *only* directories?

Henry Spencer henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org
Tue Jan 13 04:53:59 UTC 2004


On Mon, 12 Jan 2004, Peter Hiscocks wrote:
> there appears to be no way to do a directory list of *only* the
> subdirectories.

Unfortunately true, short of "ls -l | egrep '^d'".

> 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.)

Try "ls -F", which puts slashes at the ends of the directory names.

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

If you know the name of a directory and want to know its permissions --
the permissions on the *directory*, not on the files within it -- you use
"ls -ld foo".  There are several analogous uses; the point of -d is to
suppress the sometimes-overhelpful automatic expansion of directories.

                                                          Henry Spencer
                                                       henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org

--
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