Behind the scenes of ls *.c

Say what?

So you want the scoop on ls *.c?

First things first, you have to know what terminal is.

Terminal is a program on your computer that runs a shell. And a shell is a powerful tool that allows you to type commands in to your computer and then the computer listens to you. Sometimes.

So ls is…

A command that you can type into terminal to get a list. A list of what? Simply a list of the directories contents. For example:

Typing ls<return> right into terminal will show you everything in my main directory.

But wait, there’s more.

The ls command can tell you what kind of files are there, but it can also narrow it down for you if you’re looking for something specific. So lets say we’re specifically looking for any files ending in “.c”

ls *.c is what you want!

ls will make a list, we know that. * The asterisk is what they call a wild card. This wild card will make the files it finds match whatever you put after it. When *.c is put after ls that means it will make a list, of only files * that end with .c.

When that is put into the computer, the computer begins to read all of your files to find a match at what you’re looking for.

Once it’s done, the computer will give you a list of everything it found on its journey.