Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!zaphod.mps.ohio-state.edu!think.com!mintaka!ogicse!littlei!omepd!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Re: Can ls be made to only list directories? Message-ID: <1990Aug31.225443.2905@iwarp.intel.com> Date: 31 Aug 90 22:54:43 GMT References: <90243.151817SML108@psuvm.psu.edu> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 43 In-Reply-To: SML108@psuvm.psu.edu (Scott the Great) In article <90243.151817SML108@psuvm.psu.edu>, SML108@psuvm (Scott the Great) writes: | As the subject asks, is there a set of options which will limit | ls to listing directories? That's a bit ambiguous. I'll try to answer all the variations... (1) that's *all* it does anyway (taken literally). :-) Does yours send mail too? :-) :-) (2) if you mean "list the directories by name, rather than listing the contents of those directories", use the "-d" switch, as in: ls -d a* lists all names in the current directory that begin with "a", regardless of whether or not it's a directory (rather than listing the content of the directories). (3) if you mean "list *only* the directory names, and not their contents", you can do that with echo (much faster), as in: echo a*/. names all the directories in the current directory that start with "a". (4) if you mean "list *only* directories along with their contents", try a combination, as in: ls a*/. lists all the directories in the current directory that start with "a", along with their contents. === Hopefully, your meaning was in here somewhere. If not, send me email. Just another Unix hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/