The “ls” command

Jacer Dabbabi
2 min readFeb 3, 2020

What does the command do ?

The ls command is one of UNIX’s basic commands .It lists informations about the files in the current directory , sorting them alphabetically if no option is added .

What does “*.c” mean ?

In this case, it means we are sorting all files ending with “.c” in the current directory and for that we have used the wildcard “*” .

What is a wildcard ?

Wildcards are a set of building blocks that allow you to create a pattern defining a set of files or directories. As you would remember, whenever we refer to a file or directory on the command line we are actually referring to a path. Whenever we refer to a path we may also use wildcards in that path to turn it into a set of files or directories.

So how does it work ?

So, to put it simple , the shell sees that we have used a wildcard and so, before running the command “ls” it replaces the pattern with every file or directory that matches that pattern then when we run the command it sorts them alphabetically into a list .

Enjoy :) !

--

--