Architecture of Linux OS
What is Kernel?
The kernel is a computer program that is the core of a computer’s operating system, with complete control over everything in the system. Kernel is the main core component if Linux, it controls the activity of other hardware components. It visualizes the common hardware resources and provide each process with necessary virtual resources. It makes the process to wait in the ready queue and execute in consequently to avoid any kind of conflict.
What is Shell?
A shell is special user program which provide an interface to user to use operating system services. Shell accept human readable commands from user and convert them into something which kernel can understand. It is a command language interpreter that execute commands read from input devices such as keyboards or from files. The shell gets started when the user logs in or start the terminal.
What is Linux Shell Scripting?
A shell script is a computer program designed to be run by a linux shell, a command-line interpreter. A shell script is usually created for command sequences in which a user has a need to use repeatedly in order to save time. Like other programs, the shell script can contain parameters, comments and subcommands that the shell must follow. Users initiate the sequence of commands in the shell script by simply entering the file name on a command line.
Using a shell script is most useful for repetitive tasks that may be time consuming to execute by typing one line at a time. A few examples of applications shell scripts can be used for include:
Automating the code compiling process.
Running a program or creating a program environment.
Manipulating files.
Linking existing programs together.
Executing routine backups.
Monitoring a system.
Different Shells in Linux
The C Shell – csh
The Bourne Shell – sh
The Korn Shell - ksh
GNU Bourne-Again Shell – bash
T Shell – tsh
Z Shell – zsh
Script Interpreters(Shebang #! Line)
The shebang line tells the system which interpreter to use to execute the script. This is crucial because different interpreters can interpret the same script differently. By specifying the interpreter in the shebang line, you ensure that your script is interpreted as intended, regardless of the user’s default shell.
#!/bin/bash - Uses Bourne-Again Shell(bash shell) for executing the script
#!/bin/sh - Uses Bourne Shell (sh shell) for executing the script
- Write a Shell Script which prints
I will complete #90DaysOofDevOps challenge
- Write a Shell Script to take user input, input from arguments and print the variables.
- Write an Example of If else in Shell Scripting by comparing 2 numbers