Page 1 of 1

Listing only directories in Linux

Posted: 21 Jan 2015, 13:14
by viking60
I use ncdu to list my folders or directories and others may have other methods.
The obvious and easiest way has never been mentioned here so I'll mention it :-D

Code: Select all

ls -d */

This will list all directories - but not the subdirectories. This can come in handy when you are in /etc.
One should never forget the (not so?) obvious.

To find all directories that end with UTF-8 you could do this:

Code: Select all

ls -d *UTF-8/

To fins all directories that start with..say...modprobe ...you can do this:

Code: Select all

ls -d modprobe*/

In /etc that could be modprobe.d and modprobe.preload.d etc