Could you believe me if I told you that it is possible to list files with a “.c” ending in your shell?

Cristian Bedoya Blanco
2 min readJun 9, 2020

Let me explain to you how!!

First to all is important to say what command “ls” is how it works! By definition “ls” list directory contents in our working directory

And now you can see that there are several files with different extensions, What if I just want to see the files with “.c”

So we going to use something that's very useful and makes your life easier, and that is a wild card in order to perform our command. there are many characters but by today we will use “ * ” (asterisk) which matches any character or set of characters. Basically, it could be used for matching beginnings (e.g; c*)or ending (e.g:*c). You can optimize the command given it more characters (e.g: cju*, *huc).

So let's try!

In the last picture, we can see how the only files only “.c” files are printed. That´s AWESOME! RIGHT?

Note that If use “*” without any character (ls *) is the same output to ls.

Now check it out in your bash !! Let´s write!!

key words: Shell , command line, working directory & bash!

--

--

Cristian Bedoya Blanco

Materials Engineer and Software Developer. First that a professional i am humanistic person. I accepts and overcomes every single challenge.