Commands: ls *.c
In this post I will briefly explain what happens if we write ls * .c in the shell, let’s start.
When we write the ‘ls’ command in shell, we are ordering you to return the list of directories or files that the current directory has.
I am currently on the 0x03 directory, as indicated in the path we will proceed to write ‘ls’ and then press enter, as a result we will have a list of all the directories and files visible within 0x03.
See Image #1.
But, if we write ‘ls’ again, we add ‘* .c’ and press enter, we will be ordering it to show us the list again with the following condition: all (*) files or directories ending in a certain extension (.c ).
See Image #2
As we can see in the images, the ‘ls *’ command allows us to filter all the files with a certain extension, which for that matter was .c, but could be .js, .mp3, or any other.