What happens when you type ls *.c ?
Expansion is done on the command line after it has been broken into tokens. There are diferent kinds of expansions, this time I am gonig to talk abour Filename Expansion (or Pathname expansión).
Filename expansión is a shorthand for specifying filenames matching patterns. When you write an argument in the command line, Bash scans each word for the special characters ‘ * ’, ‘ ¿ ’ or ‘ [ ‘, these characters are also known as wildcards. If any of these characters appears, the word is considered a pattern ( see Pattern Matching) and is replaced by an alphabetical list of filenames that match the pattern. Then the list is passed to the program called by the command line. Let’s see an example.
When you type the following on the command line:
The shell expands the ‘*.c’ argument and lists all files in the working directory which names ends with the string ‘.c’. The the Shell passes the list to ls command.
For more info about Shell expansion check these links: