Many people they confuse the Linux Shell with the command console that this OS has. These tools are very different, so it will be necessary for you to know how they differ and what is the shell for.
You can read this in the following paragraphs. We will show you which are the tools that you should use in the Linux Shell and why you should start working from this platform.
Do not worry if you do not know this task in detail, because we will explain a guide to create a Script without errors and do not die trying. Let’s get started.
What is the Linux Shell and how is it different from the command console?
The Linux Shell is a program used to deliver a graphical interface with which the user can access the different tools that has the operating system. They can be of common text, the most used being that of Bash, or common graph, such as GNome (but this is linked with other OS). Each user can configure their own Shell according to their needs and modify it at any time with just a few steps.
Keep in mind that every time a user identifies himself, the first thing he sees is the Shell assigned to him. In the image we show you you will be able to see this tool in a simpler way. The difference between the Linux Shell and the console is that the latter is the physical part and appears in Linux as multiple ttys. It is related to the terminal, since it generates the input and output environment of the text. While the Shell is an interpreter that is used on the command line.
Put more simply, when you have to work on linux you will need to enter the console (physical environment) to perform tasks in the terminal (text input and output environment) through the Shell (command line interpreter that you put in the console).
What are the “tools” for using the Shell on Linux?
Like any computing environment, the shell needs certain elements to work on the command line.
We will show you below which are those tools necessary to work in Linux:
- Standard ticket: It is the keyboard used by the default operator and it is the one used to interactively enter different elements to the Shell. With this hardware you will be able to write the commands and parameters.
- The prompt: This tool functions as the start-up indicator that informs the user that it is waiting to receive commands. This element is configurable according to the needs of the operator. To better illustrate the prompt, we take as an example the one in MS-DOS where it is used C:>. Unlike this, in Linux the prompt appears with the name of the machine and the user.
- Commands: They are the indications that the user gives to the operating system so that it uses and traverses the directory tree and delivers certain information or configures the different files. There is a great variety of these commands, which can be divided by the type of tasks and utility they offer.
- Arguments: They are the extensions that accompany the commands and define what type of action the commands must perform and where. Unlike these, the arguments are case sensitive.
- Information received: Although this is not a tool, but you will find it in the Shell and it consists of all the data that the Operating System throws in accordance with the Linux commands and arguments you entered.
Why should you start working in the Linux Shell and not its graphical interface?
While is true that a graphical interface is more fun than the Linux Shell because it includes icons that allow you to save steps, but this does not imply that it is convenient to work on it, since it does not have all the variants and options offered by entering commands manually through a console.
In addition, when you work through the Shell, you can access it remotely through the SSH protocol without having to download any graphics on the computer from which you want to enter. Another point you should consider is that it will take less time to use the Shell than a graphical interface to perform any type of task, even though the learning is a little slower. For all this, it is always convenient to use the Shell rather than a graphical interface, even though the second option may seem easier and more useful.
Learn step by step how to create a script in the Linux Shell
A script It is a small program that is created so that the operating system performs certain tasks automatically. For this reason, it is important to know how to create one of these files to start on the Linux road.
The step by step you will have to do to create a script in the Linux Shell is as follows:
Open the Linux console
The first thing you should do is access the Shell, according to the distro you have installed on your computer, and then write:
cd $HOME && touch script.sh && chmod +x script.sh
This will make it create a file of type .sh in your personal folder.
Then enter the command:
cd $HOME && echo '#!/bin/bash' > script.sh && echo '# -*- ENCODING: UTF-8 -*-' >> script.sh
Control the script created
The previous step allowed you to create the program, but it’s still empty, so you’ll need to keep working to include the instructions. At this time you will have to open the script and include the tasks that you want it to perform.
For this you will have to enter the Shell and write:
#!/bin/bash # -*- ENCODING: UTF-8 -*-
Incorporate the instructions
The last step that you will have to take is to add the instructions you want the script to do. For example, you can say «.
This can be done by entering:
#!/bin/bash # -*- ENCODING: UTF-8 -*- echo «<° Lee Internet Paso a Paso con frecuencia» exit
Run the script
Go to the folder in which you saved the program that you just did.
Later, run these commands:
cd $HOME ./script.sh exit
If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will surely be of great help to more members of the community. Thanks! 😉