Wildcard

Wildcards are aids to searching. They are mostly used in finding files but also used in scripts and most programming languages for searching arrays and strings.

The most common wildcard is the '*' which means any number of symbols. Next most common is the '?' wildcard, which denotes a single occurence of any symbol. In some instances a '.' (period or fullstop) will act as a wildcard. There are others, that work on specific occasions, to denote NOT a character, or not a digit, or not a punctuation symbol.

For example, typing *.conf will return a list of all files in a directory (and/or depending on your search settings, subdirectories).

So searching this document for wild* would return all occurencies of 'wildcard' and 'wildcards', while searching for w?l?* would also return the instances of 'will'.

= Problems = Wildcards will not work in some scenarios.

sudo cp /root/*. it will not work because bash tries to replace the * by all files in /root, but you do not have permission to list those files.
 * If you are an ordinary user and try to copy all files from /root to your home directory:

scp user@somehost:*. bash will try to replace * by all files, but is not aware these files reside on another computer. However, with newer distributions it works.
 * If you use scp with wildcards, it cannot work at all:

= See also =
 * RegEx