What is a Shell?
A shell is a command line tool in Linux/Unix operating systems. It processes the command entered by the user and interprets into machine-readable binary form that can be understood by the Kernel to carry out the process.
What is Kernel?
The kernel is a computer program at the core of a computer's operating system and generally has complete control over everything in the system. It is the portion of the operating system code that is always resident in memory, and facilitates interactions between hardware and software components.
- Source: Wikipedia
This picture is taken from GeeksForGeeks website.
What is a Shell Script?
A shell script is a computer program designed to be run by the Unix shell, a command-line interpreter.
- Source: Wikipedia
We write shell script with the help of a special program called terminal of the Operating System. Terminal looks similar to the Command Prompt or Windows Powershell of Windows Operating System.
Types of Shell
There are various types of shell in Linux.
Some of them are as follows -
- Bourne Shell
- C Shell
- Korn Shell
- Bourne Again Shell
Shell Prompt
$ sign in the terminal is known as the Shell Prompt.
Using Shell in Windows
For Windows users, you can do any of the following -
- Set up your computer for dual boot - containing both Windows and Ubuntu together.
- Install the virtual box in your computer containing the Linux OS.
- Use Windows Subsystem for Linux( WSL) by installing it.
- Otherwise, you can use a Browser extension named OnWorks to run Ubuntu or Kali Linux online.
OnWorks Extension
OnWorks extension works on Firefox and Chrome Browsers. It acts as an emulator for the windows system creating the ISO image of the chosen OS to run it online.
- Benefit of using this extension is that you can use any OS you like to run online and all are free to use. Also, you can save your work in your Google Drive.
- Disadvantage of using it is that if you leave the tab inactive for more than 10 minutes, then you have to run the OS again as it logs you out from the session automatically. So, sometimes you might get irritated.
Writing Our First Shell Script
- Search for terminal in the search bar
- Open your terminal
- Type
gedit <filename>.sh
and then hit Enter.
- Then you'll see a text editor opens up with the file name like this -
- Now, we're are ready to write our code.
echo "Hello World"
- Now save the file and open a new terminal.
- Type
bash <filename>.sh
. Here,bash hello.sh
. - Now hit Enter to see the output.
Congratulations ๐ You have written your first shell script program.
You can also watch this video for clarity.
Hope this helps you. Thank you for reading, and let's connect!
Thank you for reading my blog. Feel free to subscribe to my YouTube Channel and connect on LinkedIn or Twitter.
Also, feel free to support my work.๐
Top comments (0)