Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

suppose in my current directory, I have 50 sub-directories. Now, I am interested only in about 20 of those sub-directories (whose names match a pattern). I would like to recursively list the contents of these 20 sub-directories. How do I do that ?

I would like to do this in Solaris 10 and Linux(RHEL 5.x).

thank you,

share|improve this question

You can use ls and find to accomplish this. Simply use find to get the directories and pass those into ls:

ls `find -type d -name my_dir`

If you need more verbose output, you can also use ls's options:

ls `find -type d -name my_dir` -al
share|improve this answer
If I remember correctly, Solaris is a BSD variant, so find will need the -print option. – pavium Jul 22 '11 at 14:37
You are probably correct. I haven't used Solaris in a long time. – sbtkd85 Jul 22 '11 at 15:37

Use tree. Just navigate to the directory you want to get the structure for, and type tree. For more see here. Use the -l and -r switches.

share|improve this answer

ls -R pattern, if you can express pattern as a shell glob.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.