For a programmer the linux terminal be like the mic of a speaker, is the tool to communicate with the public, in the same way the shell is the way we communicate with our machine. for this reazon is so important learn how the shell works.

What is a shell for starters?

For this example we will see what happens when you type ls -l in your linux terminal. LET’S GO…

On the superficial level, typing ls -l displays all the files and directories in the current working directory, along with respective permissions, owners, and created date and time. but how does it work?

1 - BREAK THE COMMAND INTO TOKENS

2 - CHECK FOR ALIASES

The Shell reads the command ls -l from the getline() function’s STDIN, parsing the command line into arguments that it is passing to the program it is executing. The Shell will then check if ls has any aliases associated with the command you entered. If any aliases are found it will expand that alias before running the command and check if the word of the command entered is a built-in command. Next, it will check for special characters such as: “, ‘, \, *, &, # and runs the logic associated with the special character.

3 - CHECK BUILT-INS

Builtin commands are contained within the shell itself. When the name of a builtin command is used as the first word of a simple command

4 - FINDS THE COMMAND IN THE PATH

PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files

5 - CALL THE PROGRAM LS WITH THE FLAG -l

6 - PRINT THE PROMPT

7 - WAIT FOR A NEW COMMAND TO BE ENTERED

And that is what happens when you type ls *.c on your command line. If you have any questions, criticism or comments, feel free to reach out to me via my email here:

danielfep.am@gmail.com

I hope this was informative!.