[plug] directory listing

Alex Nordstrom lx at se.linux.org
Mon Apr 10 13:40:41 WST 2006


Monday, 10 April 2006 13:29, Jon Miller wrote:
> After looking up the parameters for the ls command I still cannot
> find what I'm looking for which is a simple listing of all
> subdirectories starting at a certain point. I want a listing of
> subdirectories only in a directory called /shared. I've issue the
> following command ls -d and yieldednothing.

Ah, I remember this from a first-year tutorial at Curtin.

Try:

ls -d /shared/*/

What -d does is to just list all matching files (including directories). 
If you didn't have it, ls would also proceed to list the contents of 
any matching directories. The slash at the end will make sure only 
directories are matched.

For a long listing, try:

ls -l | grep ^d

Where ^d matches entries with 'd' (for directory) as the first character 
on a line.

-- 
Alex Nordstrom
http://lx.n3.net/
Please do not CC me in followups; I am subscribed to plug.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20060410/4bd8477a/attachment.pgp>


More information about the plug mailing list