Linux Shell Scripting – What and Why?

If you have known any power users of Linux or some of the developers, you would have probably heard them talk about shell scripting or shell scripts. You might even have wondered what these Linux shell scripts are, and why they are used. There is also a myth about the difficulty of using Linux shell scripts among many Linux newbies. However, the reality is, it takes just a clear understanding of Linux shell and knowledge of scripting to be able to successfully utilize the immense power of Linux shell scripts.

A Linux shell is software that allows the users of Linux to issue English-like instructions to your computer. These instructions are known as Linux commands and are passed to the Linux kernel via the Linux shell. In other words, Linux shell provides users an environment for interacting with the operating system without using a graphical user interface (GUI). There are various kinds of Linux shells available, such as BASH (Bourne-Again SHell), CSH (C SHell), KSH (Korn Shell), and TCSH. You can write shell scripts as per the Linux shell of your choice.

A shell script is a set of commands written in a way that they can be executed sequentially without any manual intervention. These scripts are stored in textual files with a .sh extension. Generally, shells are used for manually entering the commands as inputs, whereas with the use of shell scripts you can define the exact sequence of commands, manipulate their parameters and switches, and expect a composite output as a result of running the script.

With shell scripts, you can store output to files, send as e-mails, or show them on screen without typing commands on the Linux shell each time. Repetition of defined sets of tasks becomes much easier than otherwise with the shell scripts. You can utilize shell scripts to automate scheduled tasks or even facilitate system or network administration. Many MS-DOS users think of shell scripts as Linux equivalents of MS-DOS based batch files, but shell scripts are much more powerful than the batch files in MS-DOS operating system.

Uncategorized