What is shell scripting?
Shell scripting is one of the most important aspects of Linux that acts as the driving force for automation. Different utilities, programs, etc., where every command is hand in hand with the mouse itself, due to the graphical interface dominance is increasing day by day, but still, the unique contribution of scripting to Linux / UNIX is undeniable.
Shell works like a scripting doc’s batch file. That is, shell scripting is a simple text file that is written in a typical text editor and where there are instructions for managing some series. These commands can be Linux commands, commands to run a program, commands to call other scripts or any command that can be combined with all of them. Rather than giving the commands written every time, instead of executing a series of tasks, just by executing the file here, all the tasks will be done one by one.
The commands given at the shell prompt can be written in a shell script file and there are some script-based commands for different condition tests and logical flow control. When using these with other Automation Tools, something amazing can be done through this shell script file. Let’s take a look at some of these works
* cron – The cron scheduler is used to automatically run any shell script commands in a specific time or day.
* Perl scripts – call a Perl script with a shell script. If Perl starts a journey as a reporting language but it is now capable of working with the string of text files and the numerical data.
* Regular expressions – Regular expression commands are used to work with the output of the user’s input, email messages or other commands, the text or the text string of the programs (search and match the match).
* Redirection – Send commands, scripts, or program’s input/output to any other device or process.
* Piping – Use a command, script, or program output as the input of any other program.
* Custom programs – Customize a compiled program with a shell prompt and do a specific job. For example, managing a command for any data files or hardware that holds the rights.
There are several options/switches for most Linux shell commands, utilities, and programs that control the behaviors of those programs/commands. These options can be used automatically when they are used automatically. Combining it with redirection and piping, one line command is enough to accomplish a lot of tasks.
For most programs, there are additional configuration files that can be customized/customized to increase the automation capabilities of those programs/commands. For example, you created a NETRC configuration file for the FTP shell command, where the FTP server logs in, the location information of the server and file locations, as well as commands for some FTP programs (such as get, put, LCD etc.) Automatically transfer files. This .netrc file is stored in the user’s home directory by default, so the file must close the read access because your login password may be stored in it.
Using an IP tables command in a shell script, you can turn your Linux system into a proxy server/firewall machine. Here are just a few examples – many such tasks are possible through scripts.
Why is it important to know the shell command?
To bring the real skills to Linux, you must know how to work with commands in the shell prompt and how to use text-based configuration files. A lot of things can not be done in graphical mode and can be automated in shell scripts on Linux, which is basically a text file that is essentially the sum of some continuous commands. Graphical Interface Mode is a standard way of working like browsing, but you can give shell commands even if you are in a graphical mode by opening the terminal window.
Also, if you want to save the memory of the machine, you can work on turning off the graphical interface, because it uses about 32 MB of memory. While working on a graphical interface, running multiple server programs in very low memory can slow down the machine.
Working on a graphical interface works as a security and some thread for security, so it is not good to run it on the main server system. Because it allows unnecessary port openings to allow remote connections that hackers can provide for scanners.