What happens when you type ls *.c in the command line?

Abidi Ghofrane
2 min readSep 16, 2019

--

what is the Unix command to list all the files in your current directory?

RTFM

what is ls?

It’s short for the word list [ls] it lists files and directories. If the pathname is a file, ls displays information on the file according to the requested options. If the pathname is a directory, ls displays information on the files and subdirectories therein. You may obtain information on a directory itself using the -d option.

what is ls * ?

if ls is being passed an argument called *, it will look for a file or directory called * in the current directory and list it just like any other. ls doesn't treat the * character in any other way than any other one.

what is .c ?

A file with the .C file extension is a plain text C/C++ Source Code file. It can both hold an entire program’s source code in the C or C++ programming language as well as be referenced by other files from within a C project.

So what does ls *.c does ?

it simply shows you every .c file

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

--

--

Abidi Ghofrane
Abidi Ghofrane

Written by Abidi Ghofrane

Software engineering student at Holberton School Tunis

No responses yet

Write a response