Learning the Shell: What happen when you type “ls *.c” in your Shell?

Steffany Naranjo Vargas
2 min readJun 8, 2020

--

What is the shell?

The shell is a program that takes commands from the keyboard and gives them to the operating system to perform.

What is a terminal?

It’s a program called a terminal emulator. This is a program that opens a window and lets you interact with the shell. There are a bunch of different terminal emulators you can use. Most Linux distributions supply several, such as: gnome-terminal, konsole, xterm, rxvt, kvt, nxterm, and eterm.

This is how your terminal should looks like.

You can use a lot of command in your terminal but for today we are going to talk about ls command.

ls Command

ls is a Linux shell command that lists directory contents of files and directories.

This is the syntax for ls command
This is what this command should print

ls command have a lot of main options but for now we will talk just about the “*” (wildcard) with .c option

This is the syntax for this command with the main option

The ls command with *.c will list all the files with “.c” extension so will be really useful if you have a lot of file and you just need to list the ones that have this “.c” extension for example:

If i use just the command ls in my terminal i will see all the files that i have in a directory

But if i add *.c to the command ls i will see just the files with extension .c

So in this way you will list all the files with .c extension. I hope this blog helped you.

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

--

--

Steffany Naranjo Vargas
Steffany Naranjo Vargas

No responses yet

Write a response