[PLUG] Listing only directory names

Eric Wilhelm ewilhelm at sbcglobal.net
Thu Mar 10 17:10:25 UTC 2005


# The following was supposedly scribed by
# Rich Shepard
# on Thursday 10 March 2005 10:59 am:

>   I have just re-read the 'ls' man page but do not see an option that
> will let me view only the names of subdirectories and not the
> individual files. Tried piping the output of 'ls' to 'file' and
> grep'ing that for the 'd' marker, but did not have the proper options
> for file on the command line.
>
>   What is the shell solution to listing only subdirectories within a
>directory?

Not the answer, but a good read:
http://www.redhat.com/magazine/004feb05/features/bash/

find -type d

ls -l | grep '^d'

--Eric
-- 
Peer's Law: The solution to the problem changes the problem.
---------------------------------------------
    http://scratchcomputing.com
---------------------------------------------



More information about the PLUG mailing list