The ls command in Linux is used for listing the contents of any directory.
By default it lists all the contents be it a file or a directory or a link or a named pipe.
But what if you want to list only the directories How do you that.
Like anything in Linux there are several ways to accomplish the same task. Listing only the directories is no different.
Don8217t worry. I8217ll explain things in detail. Here8217s the content of the directory I am going to use in the examples here.
It is always good to do it with the familiar ls command because this is the command you use for displaying the content of a directory.
To list only the subdirectories use the -d option with ls command like this.
Here8217s the output it shows.
Read Full Post
News Link: https://linuxhandbook.com/list-only-directories/.
RSS Link: https://linuxhandbook.com/feed/.
Linux Chatter is a news aggregator service that curates some of the best Linux, Cloud, Technical Guides, Hardware and Security news. We display just enough content from the original post to spark your interest. If you like the topic, then click on the 'read full post' button to visit the author's website. Use Linux Chatter to find content from amazing authors!
Note: The content provided has been modified and is not displayed as intended by the author. Any trademarks, copyrights and rights remain with the source.
Disclaimer: Linux Chatter sources content from RSS feeds and personal content submissions. The views and opinions expressed in these articles are those of the authors and do not necessarily reflect those of Linux Chatter.