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:
This version omits the '..' and '.' directory entries and it only prints the directory name instead of "./dir". I alias it as "lsd".
There are 4 alternatives - vote for the best!
ls -F | grep /\$
but will break on directories containing newlines. Or the safe, POSIX sh way (but will miss dotfiles):
for i in *; do test -d "./$i" && printf "%s\n" "$i"; done
omit the 1 (one) if you don't need one-per-line
If you can do better, submit your command here.
You must be signed in to comment.