LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-03-2013, 05:20 PM   #16
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,980

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551

wow you all are making this harder then it needs to be to list ONLY directories in a given path use the following ls, i just turn it into an alias:

Code:
alias dird='/bin/ls -laFp | grep /'
works like a charm.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-01-2016, 11:53 AM   #17
kiyop
Member
 
Registered: Jun 2015
Distribution: Debian, Arch
Posts: 56

Rep: Reputation: Disabled
Quote:
Originally Posted by lleb View Post
i just turn it into an alias:

Code:
alias dird='/bin/ls -laFp | grep /'
Indeed, alias is useful.
But, the above also lists symbolic links for absolute paths which are not directories.
For example,
Code:
ln -s /path path
ls -laFp|grep /
lists "path -> /path".
To suppress it, you can
Code:
ls -laFp | grep /$
But I prefer
Code:
ls -la|grep ^d
Or to suppress . and .. ,
Code:
ls -lA|grep ^d
Or
Code:
find -maxdepth 1 -mindepth 1 -type d
You can read manual of ls or find by
Code:
man ls
man find

Last edited by kiyop; 04-01-2016 at 12:12 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to just list directories using ls command shazam75 Linux - Newbie 10 01-26-2006 02:34 PM
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
How may I list only the directories in command line? geraldomanaus Linux - Newbie 5 03-20-2003 12:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:36 AM.

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