Metacharacters are special characters that have particular meaning to your shell?that dollar sign or hash mark. The two I want to look at are the asterisk and the question mark. The following shows what they mean to the shell.
* | Match any number of characters |
? | Match a single character |
Extending our talk of listing files, you could list all files containing ackle by using this command:
$ ls *ackle* hackle hackles tackles
Similarly, you could find all the words that start with an h like this:
$ ls h* hackle hackles
Now, if you want to see all the seven-letter words in your directory, use this command:
$ ls ??????? hackles tackles
Each question mark represents a single letter position.