type discriminating directory listing

Jerry Peek jdpeek at RODAN.ACS.SYR.EDU
Thu May 11 17:44:38 AEST 1989


In article <1529 at cmx.npac.syr.edu> gefuchs at logiclab.cis.syr.edu (Gill E. Fuchs) writes:
> what would be the command for getting a partial directory listings
> of only the subdirectories and symbolic-links ?

I saw a few solutions that used "ls -l".  How about "ls -F", which (on BSD)
marks subdirectories with a trailing "/" and symlinks with a trailing "@"?

	ls -F | grep '[/@]$'

When you feed BSD "ls" into a pipe, it doesn't print the filenames in
columns; that's good for this test but it looks lousy on the screen if
there are lots of filenames.  A kludge for that looks like this:

	ls -F | grep '[/@]$' | pr -4 -l1 -t

The "-4" gives 4 columns -- adjust that, depending on the filename length.

--Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY
  jdpeek at rodan.acs.syr.edu, jdpeek at suvm.bitnet
  +1 315 443-3995



More information about the Comp.unix.questions mailing list