What is Kernel
The kernel is the core component of the operating system that provides low-level services for hardware devices, memory management, process management, and system security. It acts as an interface between the software applications and the hardware, and it manages system resources such as CPU, memory, and input/output devices.
The Linux kernel is open-source software and is constantly being updated and improved by a community of developers worldwide. It is modular in design, which allows it to support a wide range of hardware devices and configurations.
What is shell
A shell is a command-line interface (CLI) that provides an interactive way to communicate with the operating system. It is a program that interprets user commands and executes them on behalf of the user.
There are several types of shells available in Linux -
Bash (Bourne-Again-SHell)
Zsh (Z Shell)
KSH (kron SHell)
What is Shell Scripting
A shell script is a text file containing a series of commands and instructions that can be executed by a shell interpreter. Shell scripts are commonly used for automating tasks, performing system administration functions, and managing system resources. They can be used to perform tasks that would normally require a user to enter multiple commands at the command line.
Some examples of tasks for which we can use shell scripts are -
Automating repetitive task
Scheduled backups by system admins
Monitoring system and resources
Configuring and setting up new systems
Tasks
What is #!/bin/bash?
can we write #!/bin/sh
as well?
#!/bin/bash
is called a shebang or hashbang and it is used in shell scripts to specify the shell interpreter that which shell should be used to execute the script. In this case, #!/bin/bash
specifies that the Bash shell should be used to execute the script.
Similarly, #!/bin/sh
specifies that the Bourne shell (sh) should be used to execute the script. The Bourne shell is an older, more basic shell than Bash, but it is still widely used and supported on many systems.
You can use either #!/bin/bash
or #!/bin/sh
at the top of your shell script, depending on which shell features you need to use. If your script requires features that are specific to Bash, such as arrays or process substitution, then you should use #!/bin/bash
. If your script only requires basic shell features, then #!/bin/sh
should suffice.
Some shell scripts
Write a shell script to print 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