¿What happens when you type <ls *.c>?

Hey, welcome.
We have this little exercise today, and It is, what happens if you type in your shell the next command:

ls *.c

¿What will it display?
So to answer this question, first we need to understand what we are typing.

Command <ls>

ls command is used to display a list of the files and directories that are in the current directory. Let’s see an example:

ls file_1 file_2 fil_0.c fil_1.c
typing <ls>

As you can see in the current directory are 6 files and 2 directories.

Now let´s move on

Now you just want to list the files whit a specific extension, and to do that you will need to use an asterisk (*). That is useful to match an extension, in this case <.c>. So observe the next image:

ls *.c
typing <ls .*c>

As you can see in the first case It is typed <ls> and it displays all files in the working directory, but in the second case <ls *.c> it matches the files with the extension .c and displayed them.

¡And there you go!

Now you know how to display a specific group of files, I recommend you to keep reading and studying so you may learn even more stuff about this and other commands

--

--

--

I'm a Software Developer passionate by programming, videogames and music. Nowadays studying at Holberton School

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Loops in Ruby

Top 3 Programming Languages To Learn in 2021

How to connect MongoDB to S3 to connect with S3 integration with QuickSight

CREATING ANSIBLE ROLE TO CONFIGURE HTTPD SERVER AND HAProxy LOAD BALANCER

Create a web API using minimal API ASP.NET Core

SideStories XVIII: 3Mp10YM3Nt.exe

Programmers health

Stop Suffocating Software

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
Adrian Felipe Vides Jimenez

Adrian Felipe Vides Jimenez

I'm a Software Developer passionate by programming, videogames and music. Nowadays studying at Holberton School

More from Medium

Start With C Programming

Groot in Linux

This Is What Happens When You Type A Command Into A Terminal

Buzzer with Arduino

Buzzer with Arduino