What happens when you type a command in the Shell?

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 $ :

No alt text provided for this image

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]...

No alt text provided for this image

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).?

No alt text provided for this image

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.

No alt text provided for this image


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.

No alt text provided for this image

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.

No alt text provided for this image

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.

No alt text provided for this image

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.---

Joel Nyaga Muriithi

Software Developer | Telecommunication

2 年

Your articles are really clear and precisely informative

要查看或添加评论,请登录

Shannel Bejarano的更多文章

  • Activation Functions

    Activation Functions

    The activation function returns an output that will be generated by the neuron given an input or set of inputs. Each of…

    1 条评论
  • How to fix HTTP 500 Internal Server Error

    How to fix HTTP 500 Internal Server Error

    This Postmortem article is based on one of my Holberton School projects, where we have to fix a server which has a 500…

    2 条评论
  • ? What is IoT - Internet of Things ?

    ? What is IoT - Internet of Things ?

    The Internet of Things (IoT) is the collection of interconnected electronic devices and sensors that measure, collect…

    1 条评论
  • C - Static libraries

    C - Static libraries

    WHY USE LIBRARIES One of the tools that compilers supply us with are libraries. A library is a file containing several…

  • C COMPILATION PROCESS

    C COMPILATION PROCESS

    The word compile means to translate programming code into machine executable code. There are different ways to compile…

社区洞察

其他会员也浏览了