exclude certain files in ls
ls -I <filename>
-I = Ignore the filename, i.e., don't list the specified file.
To ignore more than one file add an -I before each filename.
ls -I file1 -I file2
To ignore files by their name extensions do the following, for example.
ls -I "*.jpg" -I "*.svg"
For me if I use -I once, it works but if I use twice it doesn't.
e.g:
ls -I *.csv
works.
But
ls -I *.csv -I *.txt
doesn't work and returns txt files instead.
--ignore did the trick for me. This is what I needed and worked.
ls -lhrt --ignore="*.gz" --ignore="*.1"
That will list me files from log folder where it exclude old backup logs.
ls --ignore={"*.jpg","*.png","*.svg"}