Yoyman Manuel Castellar Miranda
2 min readApr 15, 2020

--

What happens when you type ls -l in the shell?

Taken from my project in holberton school

This blog about our project creating our own shell with help from my peer Elkin Mejia (Twitter: @ElkinAMG, Github: https://github.com/ElkinAMG ).

What is shell?

The Shell would be the DOS environment, except for Linux, it is the command interpreter.
When you write something to the shell, for example, call an internet connection, the shell passes the request to the Kernel (system core / or rather the system itself), and the kernel in turn activates the modem and dials ..
There are several types of interpreters (shell) (which is the text / command line mode), we can mention Bash, SH, CSH, KornShell, etc … etc … there are many types, each one has its peculiarities, bash it is the default value since linux uses commands with the tab key, it can have colors to identify folders and files, it has repetition of commands, several shortcut keys to manipulate the lines (command syntax).

Ls -l use a long listing format and show us all information of the files with permission, users, group where it belongs, size of the file, date, time when it was created and file´s name.

How it works?

To understand how ls or ls -l command is executed, first we must to know some concepts.

PATH

As the name implies is the path (or the way). It is an environment ($ env) variable. These variables contain information that can be accessed through the variable name (similar to what happens in programming languages).

Using this command:

$ env

It will list all the variables defined in the system.

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin (the PATH)

Is where they find the binary programs that can be run on the system, without having to declare the specific path.

If I typ the command $ whereis ls, show the path of ls command.

And that is why the program knows where the binary of a command is.

--

--