Why does 'ls -d' not show directories

jharris4854

New Member
Joined
Oct 6, 2020
Messages
6
Reaction score
1
Credits
42
If this was already posted, I apologize; I searched for it and couldnt find what I was looking for. I know that you have to use the command 'ls -d */' to show directories only but I dont understand why. What exactly is '*/' doing in the command? Im sure its a simple answer for even a beginner, just not me lol. Thanks in advance.
 


try this :

ls -d .

it should return "." meaning current directory so there is a "path" element to it.


* is a wildcard and */ is a pattern matching all sub-directories in current directory. I think the short answer is that "ls -d" on its own is not enough information but could be wrong. The way i approach these things is that whoever wrote the stuff was obviously a twisted individual who made sure it was not logical
 
lol. Thats the same logic I came to about why it works, bc ls works without defining a "where". In fact, almost any other configuration of that command short of 'ls -d' works with a default location in mind. lol it doesnt make logical sense but thank you for your input.
 
tree is much nicer anyway :

bash-5.0$ tree -L 1 -d appstarter
appstarter
├── PHPMailer
├── app
├── fontawesome
├── node_modules
├── public
├── scss
├── tests
├── vendor
└── writable
 
Is that two different options '-L, -d'? And, I dont follow the '1' param.
 
Is that two different options '-L, -d'? And, I dont follow the '1' param.
tree -L 1 -d appstarter

-L //is level
1 //is level i want , could be 2 to go deeper
-d //directory only

appstarter is what i want to look into from location which is /var/www/htdocs apache
 

Members online


Latest posts

Top