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>

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

mejdi hrairi
mejdi hrairi

No responses yet

Write a response