SunOS 5.10 - ignore certain files in ls

0

I don't know why but I can't execute ls with ignore flag:

-bash-3.2$ ls -I '*.log'
ls: illegal option -- I

Do you know what else can I try?

xwhyz

Posted 2014-05-30T15:34:34.397

Reputation: 151

Answers

1

-I is a flag specific to GNU ls that's not found in other versions of ls.

Options include:

  • Install the GNU fileutils package and run the ls command from it.
  • Combine other tools to get similar results, such as ls | grep -v '\.log$'
  • Use shell globbing patterns to get close, such as ls *.[^g] to list all files that don't end with the letter g.

alanc

Posted 2014-05-30T15:34:34.397

Reputation: 1 032

2I see bash in the prompt. Can also use extglob: shopt -s extglob; ls !(*.log) – Rich Homolka – 2014-05-30T20:41:36.120