This section summarizes the wildcards that are used for filename expansion. The shells use the same basic wildcards, though csh, tcsh, ksh, and bash have some extensions. Unless otherwise noted, assume that wildcards are valid for all shells.
Match all characters between a and z. For example,
a[0-9] matches a0, a1, and so on, up to a9.
Match any character that does not appear within the brackets.
a[^0-9] doesn't match a0, but does match aa.
Match word1, word2, etc.
the filenames a_dog, a_cat, and a_horse.
bash and C shells only.
actually aren't filename-matching wildcards.
They expand any string, including filenames that don't exist yet,
email addresses, and more.
Match zero or one instance of abc.
matches xx or xabcx. Korn shell only.
Match zero or more instances of abc.
matches xx, xabcx, xabcabcx, etc. Korn shell only.
Match one or more instances of abc.
matches xabcx, xabcabcx, etc. Korn shell only.
Match anything that doesn't contain abc.
doesn't match xabcx or xabcabcx, but does match
practically anything else that begins or ends with x.
Korn shell only.
Match any name that doesn't match
pat must include at least one of the wildcards
To match all except a single name, here's a trick:
put brackets around one character.
For instance, you can match all except abc with
(For other shells, see
Note: wildcards do not match files whose names begin with a
.), like .cshrc.
This prevents you from
deleting (or otherwise mucking around with) these files by accident.
To match those files, type the dot literally.
.[a-z]* matches anything whose name starts with a
dot and a lowercase letter.
Watch out for plain
.*, though; it matches the directory entries
.. (see article
for suggestions on solving that problem).
 Setting the bash variable glob_dot_filenames includes these names in wildcard expansion.
And a final note: many operating systems (VAX/VMS and
consider a file's name and extension to be different
entities; therefore, you can't use a single wildcard to match both.
What do I mean? Consider the file abc.def.
Under DOS or VMS, to match
this filename you'd need the wildcard expression
*.*. The first
* matches the name (the part before the period), and the second matches
the extension (the part after the period).
Although UNIX uses extensions, they aren't considered
a separate part of the filename, so a single
* will match the