Need help with ls command

Hi,

I have the following files in my directory.

hello.txt1
hello.txt_bkp
hello.txt

I wish to list only these two files.

hello.txt1
hello.txt_bkp

ls -ltr *.txt* displays all the three instead of two.

How can I ?.... please suggest.

This is not related to ls. You can use globs with any commands. Try echo *.txt* , it will work!

  • means zero or more characters, so will match any of those.

? means 'one of any character', so perhaps *.txt?*

2 Likes