We're an ISO27001:2013 Certified Supplier


When listing files with ls, we sometimes want to see the contents of directories, and other times we want to see the directory entry itself.

If you give a wildcard argument to ls, it will recurse one level of directory:

$ ls M*
March_report.odt May_budget.ods

Hello.flac HotelCalifornia.flac TheBends.flac

To avoid the recursion, add -d to the ls command:

$ ls -d M*
March_report.odt May_budget.ods Music

You can take that one step further and list only directories (not their contents):

$ ls */ -d

Could this Linux Tip be improved? Let us know in the comments below.