What happens when you type ls *.c
We are humans and we can’t remember every filename we are working with, and besides, we have to try working smart anyway. In Linux we can type ls *.c in command line by using wildcards. Wildcards are basically an indicator to the shell that some particular part of the filename is not known to you and the shell can insert a combination of characters in those places and then work on all the newly formed filenames, or shell will do a filename “expansion” based on “ls *.c” we just typed in.
Now, more details.
- (Asterisk) Wildcard — concept
“ This represents any sequence of characters. This means that if you include a * in your filename then that part of the filename can be formed using any sequence of characters. The example below explains this concept” - (Asterisk) Wildcard — ls *.c
“Would list all the files having ‘ c‘ as the extension of their filename. Thus in this case a file named somegifs.txt file would NOT be listed since its extension is not ‘ c‘. Whereas a file named 123.c would be listed.”
The best way to learn is to practice, so find a linux terminal and practice ls *.c, and good luck.