LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-11-2005, 08:40 AM   #1
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Rep: Reputation: 30
How to I flag 'ls' to list only the current sub-directories?


Feel I should know this...

Dave
 
Old 01-11-2005, 10:29 AM   #2
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
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
 
Old 01-11-2005, 11:02 AM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Just in case there are hidden directories, you might use this: ls -d .*"/" *"/"
 
Old 01-13-2005, 02:35 AM   #4
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Original Poster
Rep: Reputation: 30
Thanks folks - thought there might be a more shorthand way I was missing...! ;-)

Dave
 
Old 01-13-2005, 04:48 AM   #5
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
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
 
Old 01-18-2005, 09:49 AM   #6
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Original Poster
Rep: Reputation: 30
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 ;-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] command to list directories only frieza Linux - Software 16 04-01-2016 11:53 AM
proftpd directories list bacon22 Linux - Networking 2 01-21-2004 09:49 AM
list sub-directories only CowboyJ Linux - Newbie 1 12-04-2003 11:42 PM
Asking LS for a list of directories only gary knott Linux - Newbie 1 11-12-2003 05:49 PM
list of directories greg108 Linux - Newbie 5 08-08-2003 03:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration