SlideShare a Scribd company logo
2
Most read
5
Most read
18
Most read
Shell Scripting
Introduction Of Shell Scripting
Shell Scripting
● If you are using any major operating system you are indirectly interacting to
shell.
● If you are running Ubuntu, Linux Mint or any other Linux distribution, you
are interacting to shell every time you use terminal.
● Let’s discuss about linux shells and shell scripting so before understanding
shell scripting we have to get familiar with following terminologies –
● Kernel
● Shell
● Terminal
Shell Scripting
● 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.
● It manages following resources of the Linux system –
● File management
● Process management
● I/O management
● Memory management
● Device management etc.
Shell Scripting
● It is often mistaken that Linus Torvalds has developed
Linux OS, but actually he is only responsible for
development of Linux kernel.
● Complete Linux system = Kernel + GNU system utilities
and libraries + other management scripts + installation.
Scripts.
Shell Scripting
● 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.
Shell Scripting
● Shell is broadly classified into two categories –
● Command Line Shell
● Graphical shell
Shell Scripting
● Shell can be accessed by user using a command line
interface.
● A special program called Terminal in linux/macOS or
Command Prompt in Windows OS is provided to type in
the human readable commands such as “cat”, “ls” etc. and
then it is being execute.
● The result is then displayed on the terminal to the user. A
terminal in Ubuntu 16.4 system looks like this –
Shell Scripting
Shell Scripting
● Graphical Shells
Graphical shells provide means for manipulating programs
based on graphical user interface (GUI), by allowing for
operations.
● Such as opening, closing, moving and resizing windows, as well
as switching focus between windows.
● Window OS or Ubuntu OS can be considered as good example
which provide GUI to user for interacting with program. User do
not need to type in command for every actions.A typical GUI in
Ubuntu system –
Shell Scripting
Shell Scripting
● There are several shells are available for Linux systems
like –
● BASH (Bourne Again SHell)
● CSH (C Shell)
● KSH (Korn SHell)
Shell Scripting
● BASH (Bourne Again SHell) –
● It is most widely used shell in Linux systems.
● It is used as default login shell in Linux systems and in
macOS.
● It can also be installed on Windows OS.
Shell Scripting
● CSH (C SHell) –
● The C shell’s syntax and usage are very similar to the C
programming language.
Shell Scripting
● KSH (Korn SHell) –
● The Korn Shell also was the base for the POSIX Shell
standard specifications etc.
● Each shell does the same job but understand different
commands and provide different built in functions.
Shell Scripting
● Shell Scripting -
● Usually shells are interactive that mean, they accept
command as input from users and execute them.
● However some time we want to execute a bunch of
commands routinely, so we have type in all commands
each time in terminal.
Shell Scripting
● As shell can also take commands as input from file we can write these
commands in a file and can execute them in shell to avoid this
repetitive work.
● These files are called Shell Scripts or Shell Programs. Shell scripts
are similar to the batch file in MS-DOS.
● Each shell script is saved with .sh file extension eg. myscript.sh
● A shell script have syntax just like any other programming language.
● If you have any prior experience with any programming language like
Python, C/C++ etc. it would be very easy to get started with it.
Shell Scripting
● A shell script comprises following elements –
● Shell Keywords – if, else, break etc.
● Shell commands – cd, ls, echo, pwd, touch etc.
● Functions
● Control flow – if..then..else, case and shell loops etc.
Shell Scripting
● Why do we need shell scripts ?
● There are many reasons to write shell scripts –
● To avoid repetitive work and automation.
● System admins use shell scripting for routine backups.
● System monitoring.
● Adding new functionality to the shell etc.
Shell Scripting
● Advantages of shell scripts :
● The command and syntax are exactly the same as those directly entered in
command line, so programmer do not need to switch to entirely different
syntax.
● Writing shell scripts are much quicker.
● Quick start.
● Interactive debugging etc.
Shell Scripting
● Disadvantages of shell scripts :
● Prone to costly errors, a single mistake can change the command which might be
harmful.
● Slow execution speed.
● Design flaws within the language syntax or implementation.
● Not well suited for large and complex task.
● Provide minimal data structure unlike other scripting languages. etc
Shell Scripting
● Command in Shell Scripting :
● Ls – The ls comand : The list command function in the linux terminal
to show all of the major directories filed under a given file system.
● Cd – The cd command : Change directory will allow the user to
change between file directories.
● Mv – The mv command : Move allow a user to move a file to another
folder.
● Mkdir – The mkdir command : Make directory command allows the
user to make a new directory.
Shell Scripting
● Man – The man command : The manual command is
used to show the manual of the inputted command.
● Touch – The touch command to make file in the directory.
● Rm – The rm command : The rmdir to remove the file and
directory in the linux OS.
● Clear – The clear command : The clear command does
exactly what it say clear. It clear all readout and
information from the screen.
Shell Scripting
● Example of Shell Scripting :
● 1. For our first shell script , we will write a script which say “Hello World”.
● Input :
●
 #!/bin/sh
●
# This is a comment!
● echo Hello World # This is a comment, too!
● Output :
● Hello World
●
Shell Scripting
Thank you

More Related Content

What's hot (20)

PPTX
Introduction to Unix
Nishant Munjal
 
PDF
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
PPT
Linux file system
Burhan Abbasi
 
PDF
Shell scripting
Manav Prasad
 
PPTX
Linux operating system ppt
Achyut Sinha
 
PPTX
Linux file system
Md. Tanvir Hossain
 
PPTX
Linux operating system - Overview
Ashita Agrawal
 
PPSX
User Administration in Linux
SAMUEL OJO
 
PPTX
Operating system components
Syed Zaid Irshad
 
PPT
Basic 50 linus command
MAGNA COLLEGE OF ENGINEERING
 
PPTX
Linux process management
Raghu nath
 
PPTX
Linux basic commands
Sagar Kumar
 
PPTX
Unix Operating System
MahakKasliwal
 
PPTX
Introduction to linux ppt
Omi Vichare
 
PPT
Linux command ppt
kalyanineve
 
PPTX
file system in operating system
tittuajay
 
PPTX
Packages In Python Tutorial
Simplilearn
 
PDF
Complete Guide for Linux shell programming
sudhir singh yadav
 
PPT
Basic Linux Internals
mukul bhardwaj
 
PPTX
Computer system architecture
venkateswarlu G
 
Introduction to Unix
Nishant Munjal
 
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
Linux file system
Burhan Abbasi
 
Shell scripting
Manav Prasad
 
Linux operating system ppt
Achyut Sinha
 
Linux file system
Md. Tanvir Hossain
 
Linux operating system - Overview
Ashita Agrawal
 
User Administration in Linux
SAMUEL OJO
 
Operating system components
Syed Zaid Irshad
 
Basic 50 linus command
MAGNA COLLEGE OF ENGINEERING
 
Linux process management
Raghu nath
 
Linux basic commands
Sagar Kumar
 
Unix Operating System
MahakKasliwal
 
Introduction to linux ppt
Omi Vichare
 
Linux command ppt
kalyanineve
 
file system in operating system
tittuajay
 
Packages In Python Tutorial
Simplilearn
 
Complete Guide for Linux shell programming
sudhir singh yadav
 
Basic Linux Internals
mukul bhardwaj
 
Computer system architecture
venkateswarlu G
 

Similar to Introduction to Shell script (20)

PDF
Linux Systems: Getting started with setting up an Embedded platform
Emertxe Information Technologies Pvt Ltd
 
PDF
Linux Internals - Part I
Emertxe Information Technologies Pvt Ltd
 
PDF
Linux systems - Getting started with setting up and embedded platform
Emertxe Information Technologies Pvt Ltd
 
PPTX
Shell programing|Shel Scripting
DaNish KaKar
 
PDF
Tips and Tricks for Increased Development Efficiency
Olivier Bourgeois
 
PPTX
Introduction to Linux
PRIYATHAMDARISI
 
PDF
Introduction to Shell Scripting: All About It
Qubited
 
PPTX
UNIX/Linux training
Michael Olafusi
 
PPTX
Command Line Interpreter
DrAmarNathDhebla
 
PDF
Linux-Internals-and-Networking
Emertxe Information Technologies Pvt Ltd
 
PDF
The Shell Game Part 1: What is a shell?
Kevin OBrien
 
PPTX
LINUX (1).pptxtytyyyyyyuuuuuuuuuuurttttttrrrrrr
0710harish
 
PDF
linux_internals_2.3 (1).pdf àaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
YasaswiniChintamalla1
 
PDF
60761 linux
Ritika Ahlawat
 
PPTX
Linux week 2
Vinoth Sn
 
PDF
Before begining linux
Shiwang Kalkhanda
 
PPTX
Linux administration training
iman darabi
 
PPTX
Linuxtraining 130710022121-phpapp01
Chander Pandey
 
Linux Systems: Getting started with setting up an Embedded platform
Emertxe Information Technologies Pvt Ltd
 
Linux systems - Getting started with setting up and embedded platform
Emertxe Information Technologies Pvt Ltd
 
Shell programing|Shel Scripting
DaNish KaKar
 
Tips and Tricks for Increased Development Efficiency
Olivier Bourgeois
 
Introduction to Linux
PRIYATHAMDARISI
 
Introduction to Shell Scripting: All About It
Qubited
 
UNIX/Linux training
Michael Olafusi
 
Command Line Interpreter
DrAmarNathDhebla
 
Linux-Internals-and-Networking
Emertxe Information Technologies Pvt Ltd
 
The Shell Game Part 1: What is a shell?
Kevin OBrien
 
LINUX (1).pptxtytyyyyyyuuuuuuuuuuurttttttrrrrrr
0710harish
 
linux_internals_2.3 (1).pdf àaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
YasaswiniChintamalla1
 
60761 linux
Ritika Ahlawat
 
Linux week 2
Vinoth Sn
 
Before begining linux
Shiwang Kalkhanda
 
Linux administration training
iman darabi
 
Linuxtraining 130710022121-phpapp01
Chander Pandey
 
Ad

Recently uploaded (20)

PDF
Using AI/ML for Space Biology Research
VICTOR MAESTRE RAMIREZ
 
PDF
UNISE-Operation-Procedure-InDHIS2trainng
ahmedabduselam23
 
PDF
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
PPTX
05_Jelle Baats_Tekst.pptx_AI_Barometer_Release_Event
FinTech Belgium
 
PDF
SQL for Accountants and Finance Managers
ysmaelreyes
 
PPTX
BinarySearchTree in datastructures in detail
kichokuttu
 
PPTX
SHREYAS25 INTERN-I,II,III PPT (1).pptx pre
swapnilherage
 
PPTX
ER_Model_with_Diagrams_Presentation.pptx
dharaadhvaryu1992
 
PDF
Business implication of Artificial Intelligence.pdf
VishalChugh12
 
PPTX
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
PPTX
thid ppt defines the ich guridlens and gives the information about the ICH gu...
shaistabegum14
 
PDF
Group 5_RMB Final Project on circular economy
pgban24anmola
 
PDF
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
PDF
apidays Singapore 2025 - Streaming Lakehouse with Kafka, Flink and Iceberg by...
apidays
 
PDF
apidays Singapore 2025 - Trustworthy Generative AI: The Role of Observability...
apidays
 
PDF
apidays Singapore 2025 - How APIs can make - or break - trust in your AI by S...
apidays
 
PDF
1750162332_Snapshot-of-Indias-oil-Gas-data-May-2025.pdf
sandeep718278
 
PPTX
SlideEgg_501298-Agentic AI.pptx agentic ai
530BYManoj
 
PPTX
What Is Data Integration and Transformation?
subhashenia
 
PPT
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
Using AI/ML for Space Biology Research
VICTOR MAESTRE RAMIREZ
 
UNISE-Operation-Procedure-InDHIS2trainng
ahmedabduselam23
 
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
05_Jelle Baats_Tekst.pptx_AI_Barometer_Release_Event
FinTech Belgium
 
SQL for Accountants and Finance Managers
ysmaelreyes
 
BinarySearchTree in datastructures in detail
kichokuttu
 
SHREYAS25 INTERN-I,II,III PPT (1).pptx pre
swapnilherage
 
ER_Model_with_Diagrams_Presentation.pptx
dharaadhvaryu1992
 
Business implication of Artificial Intelligence.pdf
VishalChugh12
 
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
thid ppt defines the ich guridlens and gives the information about the ICH gu...
shaistabegum14
 
Group 5_RMB Final Project on circular economy
pgban24anmola
 
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
apidays Singapore 2025 - Streaming Lakehouse with Kafka, Flink and Iceberg by...
apidays
 
apidays Singapore 2025 - Trustworthy Generative AI: The Role of Observability...
apidays
 
apidays Singapore 2025 - How APIs can make - or break - trust in your AI by S...
apidays
 
1750162332_Snapshot-of-Indias-oil-Gas-data-May-2025.pdf
sandeep718278
 
SlideEgg_501298-Agentic AI.pptx agentic ai
530BYManoj
 
What Is Data Integration and Transformation?
subhashenia
 
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
Ad

Introduction to Shell script

  • 2. Shell Scripting ● If you are using any major operating system you are indirectly interacting to shell. ● If you are running Ubuntu, Linux Mint or any other Linux distribution, you are interacting to shell every time you use terminal. ● Let’s discuss about linux shells and shell scripting so before understanding shell scripting we have to get familiar with following terminologies – ● Kernel ● Shell ● Terminal
  • 3. Shell Scripting ● 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. ● It manages following resources of the Linux system – ● File management ● Process management ● I/O management ● Memory management ● Device management etc.
  • 4. Shell Scripting ● It is often mistaken that Linus Torvalds has developed Linux OS, but actually he is only responsible for development of Linux kernel. ● Complete Linux system = Kernel + GNU system utilities and libraries + other management scripts + installation. Scripts.
  • 5. Shell Scripting ● 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.
  • 6. Shell Scripting ● Shell is broadly classified into two categories – ● Command Line Shell ● Graphical shell
  • 7. Shell Scripting ● Shell can be accessed by user using a command line interface. ● A special program called Terminal in linux/macOS or Command Prompt in Windows OS is provided to type in the human readable commands such as “cat”, “ls” etc. and then it is being execute. ● The result is then displayed on the terminal to the user. A terminal in Ubuntu 16.4 system looks like this –
  • 9. Shell Scripting ● Graphical Shells Graphical shells provide means for manipulating programs based on graphical user interface (GUI), by allowing for operations. ● Such as opening, closing, moving and resizing windows, as well as switching focus between windows. ● Window OS or Ubuntu OS can be considered as good example which provide GUI to user for interacting with program. User do not need to type in command for every actions.A typical GUI in Ubuntu system –
  • 11. Shell Scripting ● There are several shells are available for Linux systems like – ● BASH (Bourne Again SHell) ● CSH (C Shell) ● KSH (Korn SHell)
  • 12. Shell Scripting ● BASH (Bourne Again SHell) – ● It is most widely used shell in Linux systems. ● It is used as default login shell in Linux systems and in macOS. ● It can also be installed on Windows OS.
  • 13. Shell Scripting ● CSH (C SHell) – ● The C shell’s syntax and usage are very similar to the C programming language.
  • 14. Shell Scripting ● KSH (Korn SHell) – ● The Korn Shell also was the base for the POSIX Shell standard specifications etc. ● Each shell does the same job but understand different commands and provide different built in functions.
  • 15. Shell Scripting ● Shell Scripting - ● Usually shells are interactive that mean, they accept command as input from users and execute them. ● However some time we want to execute a bunch of commands routinely, so we have type in all commands each time in terminal.
  • 16. Shell Scripting ● As shell can also take commands as input from file we can write these commands in a file and can execute them in shell to avoid this repetitive work. ● These files are called Shell Scripts or Shell Programs. Shell scripts are similar to the batch file in MS-DOS. ● Each shell script is saved with .sh file extension eg. myscript.sh ● A shell script have syntax just like any other programming language. ● If you have any prior experience with any programming language like Python, C/C++ etc. it would be very easy to get started with it.
  • 17. Shell Scripting ● A shell script comprises following elements – ● Shell Keywords – if, else, break etc. ● Shell commands – cd, ls, echo, pwd, touch etc. ● Functions ● Control flow – if..then..else, case and shell loops etc.
  • 18. Shell Scripting ● Why do we need shell scripts ? ● There are many reasons to write shell scripts – ● To avoid repetitive work and automation. ● System admins use shell scripting for routine backups. ● System monitoring. ● Adding new functionality to the shell etc.
  • 19. Shell Scripting ● Advantages of shell scripts : ● The command and syntax are exactly the same as those directly entered in command line, so programmer do not need to switch to entirely different syntax. ● Writing shell scripts are much quicker. ● Quick start. ● Interactive debugging etc.
  • 20. Shell Scripting ● Disadvantages of shell scripts : ● Prone to costly errors, a single mistake can change the command which might be harmful. ● Slow execution speed. ● Design flaws within the language syntax or implementation. ● Not well suited for large and complex task. ● Provide minimal data structure unlike other scripting languages. etc
  • 21. Shell Scripting ● Command in Shell Scripting : ● Ls – The ls comand : The list command function in the linux terminal to show all of the major directories filed under a given file system. ● Cd – The cd command : Change directory will allow the user to change between file directories. ● Mv – The mv command : Move allow a user to move a file to another folder. ● Mkdir – The mkdir command : Make directory command allows the user to make a new directory.
  • 22. Shell Scripting ● Man – The man command : The manual command is used to show the manual of the inputted command. ● Touch – The touch command to make file in the directory. ● Rm – The rm command : The rmdir to remove the file and directory in the linux OS. ● Clear – The clear command : The clear command does exactly what it say clear. It clear all readout and information from the screen.
  • 23. Shell Scripting ● Example of Shell Scripting : ● 1. For our first shell script , we will write a script which say “Hello World”. ● Input : ●  #!/bin/sh ● # This is a comment! ● echo Hello World # This is a comment, too! ● Output : ● Hello World ●