How to get a linux directory listing for files beginning with a certain letter that doesn't descend into subdirectories?
Solution 1:
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*
Solution 2:
I believe another interesting solution to be,
ls | grep ^d
Offers the flexibility of regular expressions.
Solution 3:
find . -maxdepth 1 -name d* -type f
Okay, using find here is a tad of overkill. Just a tad.
Solution 4:
ls -ld
: It will give the list of directories, without descending into subdirectories.
Example:
ls -ld Cust*
This command will provide a listing of the files and directories which start with Cust
.
Solution 5:
ls -a | grep "^."
ls -a: it will demonstrate all files and folders (hidden files and unhidden files together)
grep "^.": it will filter the result, and it will choose to show you just the files starts with a point.