2008-08-11 01:17:53

bash: list just directories


ls -d */ 
ls -l | grep ^d
find . -maxdepth 1 -type d
ls -F | grep /$
ls -1 | while read line; do if [ -d "$line" ]; then echo $line; fi; done
ls -1|while read l;do [ -d "$l" ]&&echo $l;done
perl -e 'foreach(glob(".* *")){print "$_\n" if (-d $_)}'
perl -e 'opendir(DIR,".");foreach(readdir(DIR)){print $_ ."\n" if(-d $_);}'
just kidding ;)
...


Posted by haui | Permanent Link | Categories: linux