How may I list only the directories in command line?
Hello people,
What is the command that I can use to list only the directories in the command line (console) on Linux? I tried to read the "ls man page" but didn`t find anything. Thanks to all. |
This works for a long listing:
ls -ld *|egrep "^d" |
Wow, that is a little cryptic! Geraldomanaus, sorry but I don't have an easier one for you. I would suggest though, if this provides the desired output, put an alias in your .bashrc file so you can just use a something like 'lld' or something similar. You can make a lot of custom commands via your .bashrc file.
Just a suggestion, PhilD |
To simplify things, you only have to add the -d switch. In the man pages for ls it says:
−d, −−directory list directory entries instead of contents So: ls -d will give you directories only instead of files AND directories. |
Try
"ls -d */" If it isnt already aliased to "lsd". |
That works. I tend to go for the pipes with regular expressions.
|
All times are GMT -5. The time now is 01:26 PM. |