LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to I flag 'ls' to list only the current sub-directories? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-i-flag-ls-to-list-only-the-current-sub-directories-276509/)

davee 01-11-2005 09:40 AM

How to I flag 'ls' to list only the current sub-directories?
 
Feel I should know this...

Dave

jkobrien 01-11-2005 11:29 AM

I don't know of an ls flag that will do it but this should work...

ls -AF | grep \/

or

find . -maxdepth 1 -type d

John

homey 01-11-2005 12:02 PM

Just in case there are hidden directories, you might use this: ls -d .*"/" *"/"

davee 01-13-2005 03:35 AM

Thanks folks - thought there might be a more shorthand way I was missing...! ;-)

Dave

jkobrien 01-13-2005 05:48 AM

If it's something you need to do a lot you can always make an alias...

In tcsh...

alias lss 'ls -AF | grep \/'

Where "lss" can be anything you like.

John

davee 01-18-2005 10:49 AM

I've done that before on my on workstation, but when I have to add it to eight AIX boxes, three Lunux servers, etc, etc, etc it becomes a bit of a bind remembering which one's which...

Dave ;-)


All times are GMT -5. The time now is 03:34 PM.