Can ls be made to only list directories?

Jay A. Konigsberg jak at sactoh0.SAC.CA.US
Mon Sep 3 00:18:03 AEST 1990


>In article <90243.151817SML108 at psuvm.psu.edu> SML108 at psuvm.psu.edu (Scott the Great) writes:
>As the subject asks, is there a set of options which will limit
>ls to listing directories?

A simple solution is to pipe the output of 'ls -l' through
'grep' and anchor the leading "d" in "drwxrwxrwx" to the
begining of the string.

ls -l | grep "^d"

-- 
-------------------------------------------------------------
Jay @ SAC-UNIX, Sacramento, Ca.   UUCP=...pacbell!sactoh0!jak
If something is worth doing, its worth doing correctly.



More information about the Comp.unix.questions mailing list