Sometimes the simplest of requirements do not use the most obvious commands.
In this example UNIX has no option in the ls commands to list directories within a directories.
There are several other ways to achieve this, but I think the easiest is…

find ${dir} -type d -print

…where ${dir} is the directory in which you want to list just the sub-directories.

About troyski

I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Post navigation