In this blog post, I am going to explain what happens when you type ls *.c and hit enter in your shell step by step.

mejdi hrairi
1 min readNov 25, 2020

First of all, you must know that ls is a command that you use in the terminal to list files in the current directory.

The Character “*” has a especial meaning for shell. Specifically this character means match any characters in a filename. For example if you put: ls *hello in the terminal, you will list any filename that end with the characters “hello” in the current directory.

So, the characters .c meaning you will list filenames that ends with “.c”

If we put all together when we type ls*.c we are listing any filenames that ends with “.c” in the current directory. This is useful to identify any filename with specific type in a directory.

Thanks

Hadir Jenni <hadirjenni@gmail.com>

Hrairi mejdi <hrairimejdi99@gmail.com>

--

--