Monica
3 min readAug 29, 2019

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

It’s hard to interact for first with a command prompt, that black hole somewhere in my laptop… So, the first step to interact with the shell is goint throught Linux commands, let’s open that chapter and let’s start from the beginning.

The ls command — the list command — functions in the Linux terminal to show a list of the directory contens. It’s something like this, you don’t know what you have in your closet drawers, but let’s imagine that you have a magic button that shows you what you have in there? isn’t cool

or wait for it…

Things get better, what about if you just pressing that button and it list every single thing by content.. by content I mean, you have certains things that you use for specific momentos, go hiking/travel/ or even clean yourself, that magic buttom sort all those things for you.

let’s see..

ls works like that magic button and can show all a List information about the FILEs (in the current directory by default), on a Linux system are arranged in what is called a hierarchical directory structure and sort them according as you want to. For instance, you created a bunch of files “file1.c file2.j file3.c file4.c…” and you want to see when they where created, list every single file that ends, add the whildcard -l and you will see something like this:

Now, let’s get a closer view of what we can get when we list the files in the working directory in long format

now, let’s see where ls -l is locate in UNIX arquitecture.

The Linux system works basically on 4 layers, see the diagram below:

ls is locate in the shell, why? because the shell is a command line interpreter (plus other functions). Shell is basically a bridge between the user and the kernel, when a user type a command in the terminal, the shell interprets it and call it. How that call works? the shell requests a service from the kernel, a system call to perform an specific commant, in this case, ls. Then you will displayed your files in the terminal.

The imagen bellow shows how the shell flow works.

Linux is such a complex system but it works with a specific logic, everything is interconected and our work as developers is to understand it.

Monica

Psicologist- interested in: Big Data & Machine learning. Gardering 🍃 climber and cyclist, one day, mountaineer 🙏🏾