As an example,
[bbadger@demo01] (1)$ ls file.*
run on a directory containing the files file, file.c, file.lst, and myfile would list the files file.c and file.lst. However,
[bbadger@demo01] (1)$ ls file.?
run on the same directory would only list file.c because the ? only matches one character, no more, no less. This can save you a great deal of typing time. For example, if there is a file called california_cornish_hens_with_wild_rice and no other files whose names begin with `c', you could view the file without typing the whole name by typing this:
[bbadger@demo01] (1)$ more c*
because the c* matches that long file name.
Filenames containing metacharacters can pose many problems and should never be
intentionally created. If you do find that you've created a file with
metacharacters, and you would like to remove it, you have three options. You
may use wildcards to match metacharacter, use the to directly
enter the filename, or put the command in double quotes (except in the case of
double quotes within the file name, these must be captured with one of the
first two methods). For example, deleting a file named `*|more' can
be accomplished with:
[bbadger@demo01] (1)$ rm ??more
or
[bbadger@demo01] (1)$ rm *
|more
or
[bbadger@demo01] (1)$ rm ``*|more''