What happens when you type a command in the Shell?
first let's go step by step:
What is a Shell?
A Shell or also known as a Command Interpreter, terminal, prompt, cmd, or console. It is the interface that allows the user to communicate with the computer's kernel. Basically the program waits for you to give it a command to execute it, so you can view and manipulate computer files.
When you start the console we will find the command prompt (Prompt) which is usually a (# or $) but you can find other symbols.
something like this, in this case the symbol is $ :
What is a command?
The command is the order or instruction that we give to the terminal to execute an action or task, a very clear example is when the terminal gives the option (ls). The command (ls) should list the files and directories we have inside the folder we are in.?
The SYNOPSIS for the commands is:?Command [option]... [file]...
Another example is when executing the same command (ls), with the option (-l) the command would look like this (ls -l), this way the files and directories will also be listed, but adding the (-l) will show the long format, which is the most detailed information of the files and folders that we have in the directory, with the option (-l) you will see the (size, user, group, permissions etc).?
领英推荐
Now, what happens when we press Enter, after entering the command?
The instruction (command) given to our Shell, goes through several processes before showing us a result.
1)???When we start the console we will find the command prompt (Prompt) which is usually a?(# or?$) although you can find other symbols in the Prompt.
2)???The terminal must interpret the command
3)???The shell internally asks within its folders and files if the command entered in this case (ls -l) exists?within its structure.?as (ls -l) if it exists runs it.
4) ??If the command entered does not exist, the terminal must return an error message to the user and ask again for a new instruction.
5) When the task is executed, the terminal will again wait for a new instruction.
---What are your questions? Let me know in the comments, for the next topics to cover!I hope this tutorial has helped you a lot.---
Software Developer | Telecommunication
2 年Your articles are really clear and precisely informative