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.

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.


Hadir Jenni <>

Hrairi mejdi <>



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store