Shell – ls pattern matching

lspatternsshellwildcards

I know that [] is working in ls pattern matching:

$ ls
foo.c  foo.h
$ ls foo.[ch]
foo.c  foo.h

but I cannot find where this is documented.

I would like to know the syntax that would match these:

$ ls
foo.asd  foo.qwe

This is the best guess I had: ls foo.[{asd}{qwe}]. It did not work.

Best Answer

I think you are looking for the brace expansion {asd,qwe}:

$ ls foo.{asd,qwe}
foo.asd  foo.qwe
Related Question