Re:Favorite Unix Commands
by codegeek on Monday January 07, 2013 @03:32PM
(#5023070)
Helps me quickly list only directories. Any better alternatives ?
[ Parent
| on HN ]
Using `find` is nice to get just directories:
$ find . -type d -maxdepth 1
I use:
% ls -d */
ls -al | grep ^d
(Fails if a directory has a linefeed in its name followed by a 'd'. :-)
find . -type d
edit: for the same output as your command you can use: dir -lDunno what "better" means, but this also works:
find -maxdepth 1 -type d
seconded. what I have always used
Depends on the shell. In zsh (with EXTENDED_GLOB): *(/) matches only directories.
Re:Favorite Unix Commands
by super_mario on Monday January 07, 2013 @07:57PM
(#5024292)
I usually
alias lsd='ls -d */'ls -l | grep drw
I know, it's a bad habit
Re:Favorite Unix Commands
by joshbaptiste on Monday January 07, 2013 @10:48PM
(#5024772)
echo */ (perfect when your unable to fork)