What happens when the command ls -l * .c is typed

ls is one of the many unix commands and is characterized by allowing the user to list all files or directories in the current directory and interact with them through the command line (CLI).
In this blog we will explain step by step what happens when using the ls -l * .c command

The ls command is commonly used to list directories and files and sort them by size, date, alphabetically, check for hidden files, and show what permissions they have.

the ls command also accepts some flags that change the operation of the command

https://man7.org/linux/man-pages/man1/ls.1.html

wildcards / metacharacters

Just as in Windows Linux it also handles special characters used to perform searches among other operations on files and directories, we call these characters metacharacters and they are the following:

How does the ls -l * .c command work?

Let’s try it in the terminal…

The ls command lists the files and directories

With the -l flag we tell it to generate a vertical list of files and directories

And finally with the special character * and the file extension (.c)
We tell you to show all the files that you concede with the extension (.c)

What happens behind the scenes?

When the command ls -l * .c is entered in the linux terminal, the system recognizes that they have entered characters by keyboard and sends them to the shell, these arguments when entering are a text string, then they are divided into tokens replacing the whitespace “” at end of line “\ 0” making the string separate into words

Once the chain is divided into words, they are analyzed to see if they are functions integrated in the variable “$ PATH” executing it and performing its function.

What are system calls?

A system call is a request made by a program to the operating system. Allows a request to access operating system commands and functions Active drugs.

System calls perform system-level operations, such as communicating with hardware devices and reading and writing files. By making system calls, developers can use prewritten functions supported by the operating system (OS) instead of writing them from scratch. This simplifies development, improves application stability, and makes applications more “portable” between different versions of an operating system.

What types of system calls are there?

Process control: all processes in a computer system must be controlled so that they can be stopped at any time; system calls in this category monitor, so to speak, the starting or running or stopping / terminating processes.

File management: these types of system calls are to access operations on file manipulation. those system calls are create, delete, open, close, write and read (create, delete, open, close, write and read).

Device management: are all system calls that are used to request or manage the necessary hardware resources, such as computing power or storage space.

Information management: processes have a lot of information associated with them, and timeliness and integrity are very important. To exchange or request information, application programs use system calls for information management or maintenance.

communication between process : A smooth interaction between the operating system and the various application programs can only be guaranteed if the individual processes are coordinated. To this end, communication through the corresponding system calls is essential.

Authors

*Juan David Balanta — jdbalantar
*Juan Felipe Balanta — F_balanta

--

--

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