ls command basics???

how do i use the ls command with a single argument to list all files whose names end with the letter 'r'?

$ ls *r
or
$ ls -l *r

1 Like

sweet thanks, do you know how to list only 4 letter words in a directory?

---------- Post updated at 08:23 PM ---------- Previous update was at 08:03 PM ----------

How do i use the ls command with a single argument to list all files whose names contain only 4 letters? Also, How do i use the ls command with a single argument to list all files whose names contain either an 'l' or an 'n' as the third letter?:confused:

4 letter files

ls | egrep [a-z]{4}

3rd letter l or n

ls | egrep "..[l|n]"

Not sure if "ls" command alone can be used to get all these.

--ahamed

1 Like

hmmmm..... i cant get that command to work??

ls ??[l-n]?

this will work i guess..if the length of the words is same...
try to increase or decrease the dots depending on the size of the word

This would also match an "m" at its third place.

ls ??[ln]r

should match "l" or "n" at third place and "r" at forth.

BTW, If this is an assignment, Please do read special homework rules.