Celeb Glow
updates | March 07, 2026

How to list directories names but not their contents, in *N*X?

If I do a simple ls specifying a filename pattern, like ls A*, for directories that match the pattern, it will enter the directory and give the full listing, but how could I get just the listing for ./ and only the names of the directories inside, but not their contents?

0

3 Answers

You can try this command:

ls -d A*/
1

If you need to do it recursively you could use

find . -type d -name A\*
ls -l | grep '^d' will list only directories in the '.' current directory

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy