What happens when you type ls *.c



ls
The ls command enumerates or lists in alphabetical order the names of all content in the current working directory (directories, subdirectories, and files). Type ls and then the directory path.



*
It is a wildcard that allows us to substitute any character, as many times as we need. An example of its use may be that we want to copy all the text files (.txt) to another folder, we can use the command mv *.txt dir_to _move.



ls *.c In this command ls will alphabetically list the content of the path that follows, in this case it would be *.c and this tells us that it will list all the files that have the ending .c, since the * replaces any name that the files may have.  

But what is really happening?

When typing the command in the console, the keyboard input notices that there are parameters in the command and pushes them to the shell. Then, it generates an expansion of the [*] wildcard and sends the expanded version of the array to the ls command for interpretation. Finally, the ls command interprets the information received and displays it on the screen.






Comentarios