Sunday, July 23, 2017

How to show directory only with ls command

How to show directory only with ls command

The ls command on lubuntu (and linux in general) will output list of files and directory, but what if i just need to show list of directory with ls? how to show directory only with ls command?

Lucky for you, there is a trick to make the ls command to show only directories, here's the command that you have been looking for:
ls -ld -- */

You can also use this trick:
ls -F | grep /

This command also works:
ls -ad */

And this one too:
ls -p | grep /

No comments:

Post a Comment