Skip to main content

How to get a linux directory listing for files beginning with a certain letter that doesn't descend into subdirectories?


Suppose you are in a directory that contains many files and many subdirectories.


You want to get a directory listing of all the files beginning with the letter "d". You type


ls d*

and what you get back is mostly files in sub-directories (in particular, files in subdirectories that begin with "d").


How do you list only the files and directory names in your current directory?



Answer



Ah, I just found it on the 6th reading of the man page. It's the not-so-sensibly named "directory" parameter


ls -d d* 

Comments