ls exclude pattern

Hello,

With ls *.html I am getting all the files ending with html; what would be the best why to get all the files not ending with html?

Thanks

try 'echo *.html', it will do the same thing, since you're doing shell globbing, which isn't a feature of ls at all. shell globbing will fail if there are too many files in the directory, and shell globbing can't filter in reverse like that. grep works for an arbitrary amount of data and can filter in reverse.

# See all files ending in .html
ls | grep "\.html$"
# see all files not ending in .html
ls | grep -v "\.html$"

In ksh, or bash with extended globbing turned on:

printf "%s\n" *!(.html)