commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
There are 2 alternatives - vote for the best!
-d: list directory entries instead of contents, and do not dereference symbolic links
This command would be useful when it is desirable to list only the directories. 'egrep' chooses only the lines that begin with 'd'.
to include hidden dirs use:
tree -adL 1
(with ls, requires 'ls -ad */ .*/')
the advantage to doing it this way is that you can adjust the max depth to get more recursive results and run it on non GNU systems. It also won't print trailing slashes, which can easily be removed, but can be slightly annoying..
You could run:
# for file in `find * -maxdepth 0 -type d`;do ls -d $file;done
and in the ls -d part of the command you can put in whatever parameters you want to get things like permissions, time stamps, and ownership.
If you can do better, submit your command here.
You must be signed in to comment.