UNIX 'ls' command exclude wildcard

user1078719 picture user1078719 · Apr 8, 2012 · Viewed 26.1k times · Source

I have files a1 a2 a3 b1 b2 b3 and I need to exclude a2 and b2 from the list using ls command only.

Answer

bouzuya picture bouzuya · Apr 8, 2012

use --ignore option

ls --ignore=[ab]2