Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
This command lists directories in a current path: ls -d */

What exactly does a pattern */ do?

And how can we give an absolute path in the above command (e.g. ls -d /home/alice/Documents) just to list only directories in the path?

1 Answer

0 votes
by (36.8k points)

Please note that */ is the pattern that matches all of your subdirectories in your current directory (* would match all files and subdirectories; / restricts it to the directories). Similarly, to list all the subdirectories under /home/alice/Documents, use

 ls -d /home/alice/Documents/*/

Want to be a Linux expert? Come and join this Linux course 

Related questions

0 votes
1 answer
asked Dec 2, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
asked Nov 30, 2020 in Linux by dev_sk2311 (45k points)
0 votes
1 answer
0 votes
1 answer
asked Dec 5, 2020 in Linux by blackindya (18.4k points)

Browse Categories

...