¿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

IMPLEMENTING MACHINE LEARNING MODEL INSIDE DOCKER CONTAINER(TASK 1)

Azure Solutions Architect Preparation (AZ-300, AZ-301)

Build your personal website without spending any money

Why You Will Fall in Love With Python Lists

Compressed Sparse formats CSR and CSC in Python

Bending Moment and Shear Force Diagrams for Solid Bodies in ANSYS Workbench | Nick J Stevens

Some great resources to learn ethical hacking

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

Azure Hybrid Benefit for Linux

Bash alias for cleaning git branches

How to Copy a folder across multiple user accounts on a Linux Ubuntu 20.0 Virtual Machine on azure.

This is the structure of directories on the hard drive.

How to Recover/Restore a deleted Azure Git Repository?