SlideShare a Scribd company logo
1 of 47
UNIT 1- OVERVIEW OF
OPERATING SYSTEM
- Apurva Bijawe
WHAT IS OPERATING SYSTEM ?
• Operating System lies in the category of system software. It basically manages
all the resources of the computer.
• An operating system acts as an interface between the software and different
parts of the computer or the computer hardware.
• The operating system is designed in such a way that it can manage the overall
resources and operations of the computer.
• Operating System is a fully integrated set of specialized programs that handle
all the operations of the computer. It controls and monitors the execution of all
other programs that reside in the computer, which also includes application
programs and other system software of the computer. Examples of Operating
Systems are Windows, Linux, Mac OS, etc.
• An Operating System (OS) is a collection of software that manages computer
hardware resources and provides common services for computer programs. The
operating system is the most important type of system software in a computer
system.
EXAMPLES OF OPERATING SYSTEMS
• Windows (GUI-based, PC)
• GNU/Linux (Personal, Workstations, ISP, File, and
print server, Three-tier client/Server)
• macOS (Macintosh), used for Apple’s personal
computers and workstations (MacBook, iMac).
• Android (Google’s Operating System for
smartphones/tablets/smartwatches)
• iOS (Apple’s OS for iPhone, iPad, and iPod Touch)
WHAT IS AN OPERATING SYSTEM USED FOR?
• The operating system helps in improving the computer software as well as
hardware. Without OS, it became very difficult for any application to be user-
friendly.
• The Operating System provides a user with an interface that makes any
application attractive and user-friendly. The operating System comes with a
large number of device drivers that make OS services reachable to the hardware
environment.
• Each and every application present in the system requires the Operating System.
The operating system works as a communication channel between system
hardware and system software.
• The operating system helps an application with the hardware part without
knowing about the actual hardware configuration. It is one of the most important
parts of the system and hence it is present in every device, whether large or
small device.
OS ACTS AS MEDIUM BETWEEN HARDWARE
AND APPLICATION PROGRAMS
EVOLUTION OF OPERATING SYSTEMS
• First Generation (1945-1955)
• It is the beginning of the development of
electronic computing systems which are
substitutes for mechanical computing systems.
Because of the drawbacks in mechanical
computing systems like, the speed of humans to
calculate is limited and humans can easily make
mistakes. In this generation there is no operating
system, so the computer system is given
instructions which must be done directly.
• Example − Types of operating systems and
devices used is Plug Boards.
Second Generation (1955-1965)
The Batch operating system was introduced in the second
generation, where a job or a task that can be done in a
series, and then executed sequentially. In this
generation, the computer system is not equipped with
an operating system, but several operating system
functions exist like FMS and IBSYS.
Example − Type of operating system and devices used
is Batch systems.
Third Generation (1965-1980)
The development of the operating system was developed
to serve multiple users at once in the third generation.
Here the interactive users can communicate through an
online terminal to a computer, so the operating system
becomes multi-user and multiprogramming.
Example − Type of operating system and devices used is
Multiprogramming.
Fourth Generation (1980-Now)
In this generation the operating system is used for computer
networks where users are aware of the existence of computers that
are connected to one another.
At this generation users are also comforted with a Graphical User
Interface (GUI) which is an extremely comfortable graphical computer
interface, and the era of distributed computing has also begun.
With the occurrence of new wearable devices like Smart Watches,
Smart Glasses, and others, the demand for conventional operating
systems has also increased.
And, with the onset of new devices like wearable devices, which
includes Smart Watches, Smart Glasses, etc, the demand for
unconventional operating systems is also rising.
Example − Type of operating system and devices used is personal
computers
FUNCTIONS OF OPERATING SYSTEMS
MEMORY MANAGEMENT
• The operating system manages the Primary Memory or Main
Memory. Main memory is made up of a large array of bytes or
words where each byte or word is assigned a certain address.
• Main memory is fast storage and it can be accessed directly by
the CPU. For a program to be executed, it should be first loaded
in the main memory.
• An operating system manages the allocation and deallocation
of memory to various processes and ensures that the other
process does not consume the memory allocated to one
process.
Operating System performs the following activities
for memory management:
•It keeps track of primary memory, i.e., which bytes of memory
are used by which user program. The memory addresses that
have already been allocated and the memory addresses of the
memory that has not yet been used.
•In multiprogramming, the OS decides the order in which
processes are granted memory access, and for how long.
•It Allocates the memory to a process when the process
requests it and deallocates the memory when the process has
terminated or is performing an I/O operation.
PROCESSOR MANAGEMENT
• In a multi-programming environment, the OS decides the order in
which processes have access to the processor, and how much
processing time each process has. This function of OS is
called Process Scheduling.
An Operating System performs the following activities
for Processor Management.
• An operating system manages the processor’s work by allocating
various jobs to it and ensuring that each process receives enough
time from the processor to function properly.
Keeps track of the status of processes.
• The program which performs this task is known as a traffic
controller. Allocates the CPU that is a processor to a process.
De-allocates processor when a process is no longer required.
DEVICE MANAGEMENT
• An OS manages device communication via its respective drivers.
It performs the following activities for device management.
• Keeps track of all devices connected to the system.
• designates a program responsible for every device known as the
Input/Output controller.
• Decide which process gets access to a certain device and for
how long. Allocates devices effectively and efficiently.
• Deallocates devices when they are no longer required. There are
various input and output devices.
• an OS controls the working of these input-output devices. It
receives the requests from these devices,
• performs a specific task, and communicates back to the
requesting process.
FILE MANAGEMENT
• A file system is organized into directories for efficient or easy
navigation and usage. These directories may contain other
directories and other files.
• An Operating System carries out the following file management
activities. It keeps track of where information is stored,
• user access settings, the status of every file, and more. These
facilities are collectively known as the file system.
• An OS keeps track of information regarding the creation, deletion,
transfer, copy, and storage of files in an organized way.
• It also maintains the integrity of the data stored in these files,
including the file directory structure, by protecting against
unauthorized access.
SECURITY MANAGEMENT
• The operating system uses password protection to protect user
data and similar other techniques.
• it also prevents unauthorized access to programs and user data.
• The operating system provides various techniques which assure
the integrity and confidentiality of user data.
The following security measures are used to protect user data:
• Protection against unauthorized access through login.
• Protection against intrusion by keeping the firewall active.
• Protecting the system memory against malicious access.
• Displaying messages related to system vulnerabilities.
ERROR-DETECTING AIDS
• The operating system constantly monitors the system to
detect errors and avoid malfunctioning computer systems.
• From time to time, the operating system checks the system
for any external threat or malicious software activity.
• It also checks the hardware for any type of damage. This
process displays several alerts to the user so that the
appropriate action can be taken against any damage caused
to the system.
VIRTUAL MACHINES
• A virtual machine (VM) is a software-based emulation of a
physical computer. It allows you to run multiple operating
systems on a single physical machine, enabling greater
flexibility, resource utilization, and isolation.
• Virtualization technology is widely used in data centers,
development environments, and testing scenarios.
VIRTUAL MACHINES WITH AN EXAMPLE:
1. Hypervisor:
• A hypervisor, also known as a Virtual Machine Monitor
(VMM), is a crucial component that manages and allocates
resources for virtual machines. There are two types of
hypervisors:
• Type 1 (bare-metal) runs directly on the hardware, while
• Type 2 (hosted) runs on top of an operating system.
2. Virtualization Layer:
• The virtualization layer abstracts the physical hardware and
creates virtual resources that can be allocated to virtual
machines. This layer is managed by the hypervisor.
3. Virtual Machines:
•Virtual machines are instances of emulated computers
running on a host machine.
•Each VM has its own virtual hardware, including a virtual
CPU, memory, storage, and network interfaces.
Example:
•Let's say you have a powerful server with a hypervisor
installed, such as VMware vSphere (a popular Type 1
hypervisor). You want to run multiple operating systems on
this server.
•Step 1: Hypervisor Installation
• Install the hypervisor on the physical server.
•Step 2: Virtual Machine Creation
• Use the hypervisor's management interface to create
virtual machines. For example, you decide to create
two VMs: one running Windows Server and another
running Linux.
•Step 3: Resource Allocation
• Specify the amount of CPU cores, RAM, and storage
each VM should have. The hypervisor ensures that
these resources are isolated and allocated to the
respective VMs.
Step 4: Operating System Installation
•Install the operating systems (Windows Server and Linux) on each virtual
machine as if they were running on physical hardware.
Step 5: Running Multiple OSes Simultaneously
•Now, you can run both virtual machines simultaneously on the same physical
server. Each VM operates independently, and the hypervisor ensures that they
don't interfere with each other.
Benefits of Virtual Machines:
•Isolation: VMs are isolated from each other, preventing one VM from affecting
others.
•Resource Utilization: Multiple VMs can share the same physical resources efficiently.
•Flexibility: VMs can be easily moved, copied, or modified, providing flexibility in
managing and deploying software.
Virtual machines are a fundamental technology in modern computing, providing a
versatile and efficient way to utilize hardware resources.
INTRODUCTION TO LINUX OS
• Linux is an operating system, similar to Windows or macOS,
but it's open-source, meaning that its source code is freely
available for anyone to view, modify, and distribute.
1.What is Linux?
• Linux is an operating system, the software that manages all
the hardware and software resources on your computer. It's
part of a family of free and open-source operating systems
based on the Linux kernel.
2.Open Source:
• Linux is open source, which means that its source code is
accessible to everyone. This encourages collaboration and
allows users to customize and improve the system.
3.Distributions (Distros):
• Different versions of Linux are packaged and distributed by
various organizations or communities. These versions are
called distributions or distros. Examples include Ubuntu,
Fedora, and Debian.
4.Graphical User Interface (GUI) vs. Command Line Interface
(CLI):
• Linux provides both a graphical desktop environment
(similar to Windows or macOS) and a command-line
interface (text-based). Users can choose the interface that
suits them best.
5. Multitasking and Multiuser:
• Linux supports multitasking, allowing you to run multiple
applications simultaneously. It's also a multiuser system,
meaning multiple users can log in and use the system
concurrently.
6. File System:
• Linux uses a hierarchical file system, organizing files and
directories in a tree-like structure. The root directory ("/")
is the top-level directory.
7. Terminal and Commands:
• The command-line interface, accessed through a terminal,
allows users to interact with the system using commands.
Commands are typed in text form to perform various tasks
like file manipulation, system configuration, and software
installation.
8. Package Management:
• Linux uses package management systems to install,
update, and remove software. Users can easily install new
applications and keep the system up to date using package
managers like apt, yum, or dnf.
9. Security:
1. Linux is known for its security features. Users operate with
different levels of permissions, and the system has robust
security mechanisms to protect against malware and
unauthorized access.
10. Servers and Embedded Systems:
1. Linux is widely used for servers, running the backbone of the
internet and hosting various services. It's also prevalent in
embedded systems, like routers and smart devices.
In summary, Linux is an open-source operating system that provides
users with a choice of interfaces, powerful command-line
capabilities, and a robust and secure environment. It's versatile and
used in various applications, from personal computers to servers
and embedded systems.
ARCHITECTURE OF OPERATING
SYSTEMS
1. Kernel:
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.
2. System Library:
System libraries are some predefined functions by using which any
application programs or system utilities can access kernel’s
features. These libraries are the foundation upon which any
software can be built.
Some of the most common system libraries are:
1.GNU C library: This is the C library that provides the most
fundamental system for the interface and execution of C programs.
This provides may in-built functions for the execution.
2.libpthread (POSIX Threads): This library plays important role
for multithreading in Linux, it allows users for creating and
managing multiple threads.
3.libdl (Dynamic Linker): This library is responsible for the loading
and linking file at the runtime.
4.libm (Math Library): This library provides user with all kind of
mathematical function and their execution.
3. Shell: It is an interface among the kernel and user. It can afford the services of
kernel. It can take commands through the user and runs the functions of the
kernel.
The shell is available in distinct types of OSes. These operating systems are
categorized into two different types, which are the graphical shells and command-
line shells.
The graphical line shells facilitate the graphical user interface, while the command
line shells facilitate the command line interface. Thus, both of these shells
implement operations. However, the graphical user interface shells work slower as
compared to the command-line interface shells.
There are a few types of these shells which are categorized as follows:
•Korn shell
•Bourne shell
•C shell
•POSIX shell
4. Hardware Layer:
Hardware layer of Linux is the lowest level of operating
system track.
It is plays a vital role in managing all the hardware
components.
It includes device drivers, kernel functions, memory
management, CPU control, and I/O operations.
This layer generalizes hard complexity, by providing an
interface for software by assuring proper functionality of all
the components.
5. System utility:
System utilities are the command line tools that
preforms various tasks provided by user to make system
management and administration better.
These utilities enables user to perform different tasks,
such as file management, system monitoring, network
configuration, user management etc.
BASH SHELL SCRIPTING
• Bash Script:
• A Bash Shell Script is a plain text file containing a set of
various commands that we usually type in the command
line. It is used to automate repetitive tasks on Linux
filesystem. It might include a set of commands, or a single
command, or it might contain the hallmarks of imperative
programming like loops, functions, conditional constructs,
etc. Effectively, a Bash script is a computer program written
in the Bash programming language.
HOW TO CREATE AND RUN A BASH SCRIPT?
1. Create the Bash Script:
• Open a text editor (like nano, vim, emacs, or even a
graphical text editor like gedit).
• Write your Bash script in the editor. For example, let's
create a simple script named myscript.sh:
#!/bin/bash
echo "Hello, this is my Bash script!“
• Save file with .sh extension (myscript.sh)
2. MAKE THE SCRIPT EXECUTABLE:
• In order to run the script, you need to make it executable. Open a terminal and
use the chmod command:
• chmod +x myscript.sh
• In the context of the chmod command, the +x flag is used to add the execute
permission to a file. Here's what each part of the command means:
• chmod: This is the command to change file permissions in Unix-like operating
systems.
• +x: This flag specifies that you want to add the execute permission. The letter
x stands for execute.
• myscript.sh: This is the name of the file for which you want to modify
permissions.
So, chmod +x myscript.sh means you are adding execute permission to the file
3.RUN THE BASH SCRIPT:
• You can now execute your script using ./ followed by the script name:
./myscript.sh
• Alternative Ways to Run the Script:
you can also run the script using the bash command:
bash myscript.sh
• Or by using the source command:
source myscript.sh
BASH COMMANDS
1. Echo and Variables:
# Echo command
echo "Hello,World!"
#Variables
name="John"
echo "My name is $name"
2. USER INPUT
• # Reading user input
• echo -n "Enter your name: "
• read username
• echo "Hello, $username!"
3. CONDITIONAL STATEMENTS (IF-ELSE):
• # Conditional statement
• if [ "$name" == "John" ]; then
• echo "You are John."
• else
• echo "You are not John."
• fi
4. LOOPS (FOR LOOP):
• # Conditional statement
• if [ "$name" == "John" ]; then
• echo "You are John."
• else
• echo "You are not John."
• fi
5. FUNCTIONS:
• # Function definition
• greet() {
• echo "Hello, $1!"
• }
• # Function call
• greet "Alice"
6. CONDITIONAL STATEMENTS
(CASE): *)
echo "Unknown fruit."
;;
esac
# Case statement
fruit="apple“
case $fruit in
"apple")
echo "It's an apple."
;;
"banana")
echo "It's a banana."
;;
7.FILE OPERATIONS:
• # Creating a file
touch newfile.txt
• # Writing to a file
echo "This is some text." > newfile.txt
• # Appending to a file
echo "More text." >> newfile.txt
• # Reading from a file
content=$(cat newfile.txt)
echo "File content: $content"
• Redirect to a File (>):
The > operator is used to redirect standard output to a file. If the
file doesn't exist, it will be created. If it already exists, its contents
will be overwritten.
command > output.txt
• Append to a File (>>):
The >> operator is similar to >, but it appends the output to the
end of the file instead of overwriting the file.
command >> output.txt
OVERVIEW OF OPERATING SYSTEM -Basic concepts of operating system like functions of OS and other shell commands
OVERVIEW OF OPERATING SYSTEM -Basic concepts of operating system like functions of OS and other shell commands

More Related Content

What's hot

Operating System 3
Operating System 3Operating System 3
Operating System 3tech2click
 
Operating system || Chapter 1: Introduction
Operating system || Chapter 1: IntroductionOperating system || Chapter 1: Introduction
Operating system || Chapter 1: IntroductionAnkonGopalBanik
 
Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresWayne Jones Jnr
 
Process management in os
Process management in osProcess management in os
Process management in osSumant Diwakar
 
Synchronization hardware
Synchronization hardwareSynchronization hardware
Synchronization hardwareSaeram Butt
 
Operating systems Basics
Operating systems BasicsOperating systems Basics
Operating systems BasicsSherif Mousa
 
Kernel. Operating System
Kernel. Operating SystemKernel. Operating System
Kernel. Operating Systempratikkadam78
 
Os presentation process
Os presentation processOs presentation process
Os presentation processNaseer Ahmad
 
types of operating system
types of operating systemtypes of operating system
types of operating systemMahira Rashdi
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Schedulingvampugani
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Gaurav Aggarwal
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGgarishma bhatia
 
Operating Systems Presentation
Operating Systems Presentation Operating Systems Presentation
Operating Systems Presentation Mayank Thanki
 

What's hot (20)

Operating System 3
Operating System 3Operating System 3
Operating System 3
 
Operating system || Chapter 1: Introduction
Operating system || Chapter 1: IntroductionOperating system || Chapter 1: Introduction
Operating system || Chapter 1: Introduction
 
Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System Structures
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Synchronization hardware
Synchronization hardwareSynchronization hardware
Synchronization hardware
 
Types of o.s
Types of o.sTypes of o.s
Types of o.s
 
Operating systems Basics
Operating systems BasicsOperating systems Basics
Operating systems Basics
 
Kernel. Operating System
Kernel. Operating SystemKernel. Operating System
Kernel. Operating System
 
Os presentation process
Os presentation processOs presentation process
Os presentation process
 
types of operating system
types of operating systemtypes of operating system
types of operating system
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Alpha & Beta Testing
Alpha & Beta TestingAlpha & Beta Testing
Alpha & Beta Testing
 
step by step to install the ubuntu
step by step to install the ubuntustep by step to install the ubuntu
step by step to install the ubuntu
 
Types Of Operating Systems
Types Of Operating SystemsTypes Of Operating Systems
Types Of Operating Systems
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULING
 
Operating Systems Presentation
Operating Systems Presentation Operating Systems Presentation
Operating Systems Presentation
 
Deadlock Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
 

Similar to OVERVIEW OF OPERATING SYSTEM -Basic concepts of operating system like functions of OS and other shell commands

lecture 1 (Introduction to Operating System.)
lecture 1 (Introduction to Operating System.)lecture 1 (Introduction to Operating System.)
lecture 1 (Introduction to Operating System.)WajeehaBaig
 
week-1-200310134908.pptx
week-1-200310134908.pptxweek-1-200310134908.pptx
week-1-200310134908.pptxssuser5c874e
 
os unit 1 (2).pptx. introduction to operating systems
os unit 1 (2).pptx. introduction to operating systemsos unit 1 (2).pptx. introduction to operating systems
os unit 1 (2).pptx. introduction to operating systemsssuser6aef00
 
Operating system.pptx
Operating system.pptxOperating system.pptx
Operating system.pptxYashikaJain82
 
Operating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdfOperating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdfFahanaAbdulVahab
 
Nt introduction(os)
Nt introduction(os)Nt introduction(os)
Nt introduction(os)NehaTadam
 
Chapter one_oS.ppt
Chapter one_oS.pptChapter one_oS.ppt
Chapter one_oS.pptmiki304759
 
Introduction of os and types
Introduction of os and typesIntroduction of os and types
Introduction of os and typesPrakash Sir
 
Engg-0505-IT-Operating-Systems-2nd-year.pdf
Engg-0505-IT-Operating-Systems-2nd-year.pdfEngg-0505-IT-Operating-Systems-2nd-year.pdf
Engg-0505-IT-Operating-Systems-2nd-year.pdfnikhil287188
 

Similar to OVERVIEW OF OPERATING SYSTEM -Basic concepts of operating system like functions of OS and other shell commands (20)

lecture 1 (Introduction to Operating System.)
lecture 1 (Introduction to Operating System.)lecture 1 (Introduction to Operating System.)
lecture 1 (Introduction to Operating System.)
 
week-1-200310134908.pptx
week-1-200310134908.pptxweek-1-200310134908.pptx
week-1-200310134908.pptx
 
os unit 1 (2).pptx. introduction to operating systems
os unit 1 (2).pptx. introduction to operating systemsos unit 1 (2).pptx. introduction to operating systems
os unit 1 (2).pptx. introduction to operating systems
 
OS chapter 1.pptx
OS chapter 1.pptxOS chapter 1.pptx
OS chapter 1.pptx
 
OS chapter 1.pptx
OS chapter 1.pptxOS chapter 1.pptx
OS chapter 1.pptx
 
1. Introduction to OS.ppt
1. Introduction to OS.ppt1. Introduction to OS.ppt
1. Introduction to OS.ppt
 
OS.pptx
OS.pptxOS.pptx
OS.pptx
 
Operating system.pptx
Operating system.pptxOperating system.pptx
Operating system.pptx
 
Introduction to operating systems
 Introduction to operating systems Introduction to operating systems
Introduction to operating systems
 
Ch1 - OS.pdf
Ch1 - OS.pdfCh1 - OS.pdf
Ch1 - OS.pdf
 
unit1 part1.ppt
unit1 part1.pptunit1 part1.ppt
unit1 part1.ppt
 
Operating System-adi.pdf
Operating System-adi.pdfOperating System-adi.pdf
Operating System-adi.pdf
 
Operating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdfOperating Systems PPT 1 (1).pdf
Operating Systems PPT 1 (1).pdf
 
OS Content.pdf
OS Content.pdfOS Content.pdf
OS Content.pdf
 
Nt introduction(os)
Nt introduction(os)Nt introduction(os)
Nt introduction(os)
 
Chapter one_oS.ppt
Chapter one_oS.pptChapter one_oS.ppt
Chapter one_oS.ppt
 
ch1.ppt
ch1.pptch1.ppt
ch1.ppt
 
Introduction of os and types
Introduction of os and typesIntroduction of os and types
Introduction of os and types
 
Operating systems1[1]
Operating systems1[1]Operating systems1[1]
Operating systems1[1]
 
Engg-0505-IT-Operating-Systems-2nd-year.pdf
Engg-0505-IT-Operating-Systems-2nd-year.pdfEngg-0505-IT-Operating-Systems-2nd-year.pdf
Engg-0505-IT-Operating-Systems-2nd-year.pdf
 

Recently uploaded

VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 

Recently uploaded (20)

VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 

OVERVIEW OF OPERATING SYSTEM -Basic concepts of operating system like functions of OS and other shell commands

  • 1. UNIT 1- OVERVIEW OF OPERATING SYSTEM - Apurva Bijawe
  • 2. WHAT IS OPERATING SYSTEM ? • Operating System lies in the category of system software. It basically manages all the resources of the computer. • An operating system acts as an interface between the software and different parts of the computer or the computer hardware. • The operating system is designed in such a way that it can manage the overall resources and operations of the computer. • Operating System is a fully integrated set of specialized programs that handle all the operations of the computer. It controls and monitors the execution of all other programs that reside in the computer, which also includes application programs and other system software of the computer. Examples of Operating Systems are Windows, Linux, Mac OS, etc. • An Operating System (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs. The operating system is the most important type of system software in a computer system.
  • 3.
  • 4. EXAMPLES OF OPERATING SYSTEMS • Windows (GUI-based, PC) • GNU/Linux (Personal, Workstations, ISP, File, and print server, Three-tier client/Server) • macOS (Macintosh), used for Apple’s personal computers and workstations (MacBook, iMac). • Android (Google’s Operating System for smartphones/tablets/smartwatches) • iOS (Apple’s OS for iPhone, iPad, and iPod Touch)
  • 5. WHAT IS AN OPERATING SYSTEM USED FOR? • The operating system helps in improving the computer software as well as hardware. Without OS, it became very difficult for any application to be user- friendly. • The Operating System provides a user with an interface that makes any application attractive and user-friendly. The operating System comes with a large number of device drivers that make OS services reachable to the hardware environment. • Each and every application present in the system requires the Operating System. The operating system works as a communication channel between system hardware and system software. • The operating system helps an application with the hardware part without knowing about the actual hardware configuration. It is one of the most important parts of the system and hence it is present in every device, whether large or small device.
  • 6. OS ACTS AS MEDIUM BETWEEN HARDWARE AND APPLICATION PROGRAMS
  • 7. EVOLUTION OF OPERATING SYSTEMS • First Generation (1945-1955) • It is the beginning of the development of electronic computing systems which are substitutes for mechanical computing systems. Because of the drawbacks in mechanical computing systems like, the speed of humans to calculate is limited and humans can easily make mistakes. In this generation there is no operating system, so the computer system is given instructions which must be done directly. • Example − Types of operating systems and devices used is Plug Boards.
  • 8. Second Generation (1955-1965) The Batch operating system was introduced in the second generation, where a job or a task that can be done in a series, and then executed sequentially. In this generation, the computer system is not equipped with an operating system, but several operating system functions exist like FMS and IBSYS. Example − Type of operating system and devices used is Batch systems.
  • 9. Third Generation (1965-1980) The development of the operating system was developed to serve multiple users at once in the third generation. Here the interactive users can communicate through an online terminal to a computer, so the operating system becomes multi-user and multiprogramming. Example − Type of operating system and devices used is Multiprogramming.
  • 10. Fourth Generation (1980-Now) In this generation the operating system is used for computer networks where users are aware of the existence of computers that are connected to one another. At this generation users are also comforted with a Graphical User Interface (GUI) which is an extremely comfortable graphical computer interface, and the era of distributed computing has also begun. With the occurrence of new wearable devices like Smart Watches, Smart Glasses, and others, the demand for conventional operating systems has also increased. And, with the onset of new devices like wearable devices, which includes Smart Watches, Smart Glasses, etc, the demand for unconventional operating systems is also rising. Example − Type of operating system and devices used is personal computers
  • 12. MEMORY MANAGEMENT • The operating system manages the Primary Memory or Main Memory. Main memory is made up of a large array of bytes or words where each byte or word is assigned a certain address. • Main memory is fast storage and it can be accessed directly by the CPU. For a program to be executed, it should be first loaded in the main memory. • An operating system manages the allocation and deallocation of memory to various processes and ensures that the other process does not consume the memory allocated to one process.
  • 13. Operating System performs the following activities for memory management: •It keeps track of primary memory, i.e., which bytes of memory are used by which user program. The memory addresses that have already been allocated and the memory addresses of the memory that has not yet been used. •In multiprogramming, the OS decides the order in which processes are granted memory access, and for how long. •It Allocates the memory to a process when the process requests it and deallocates the memory when the process has terminated or is performing an I/O operation.
  • 14. PROCESSOR MANAGEMENT • In a multi-programming environment, the OS decides the order in which processes have access to the processor, and how much processing time each process has. This function of OS is called Process Scheduling. An Operating System performs the following activities for Processor Management. • An operating system manages the processor’s work by allocating various jobs to it and ensuring that each process receives enough time from the processor to function properly. Keeps track of the status of processes. • The program which performs this task is known as a traffic controller. Allocates the CPU that is a processor to a process. De-allocates processor when a process is no longer required.
  • 15. DEVICE MANAGEMENT • An OS manages device communication via its respective drivers. It performs the following activities for device management. • Keeps track of all devices connected to the system. • designates a program responsible for every device known as the Input/Output controller. • Decide which process gets access to a certain device and for how long. Allocates devices effectively and efficiently. • Deallocates devices when they are no longer required. There are various input and output devices. • an OS controls the working of these input-output devices. It receives the requests from these devices, • performs a specific task, and communicates back to the requesting process.
  • 16. FILE MANAGEMENT • A file system is organized into directories for efficient or easy navigation and usage. These directories may contain other directories and other files. • An Operating System carries out the following file management activities. It keeps track of where information is stored, • user access settings, the status of every file, and more. These facilities are collectively known as the file system. • An OS keeps track of information regarding the creation, deletion, transfer, copy, and storage of files in an organized way. • It also maintains the integrity of the data stored in these files, including the file directory structure, by protecting against unauthorized access.
  • 17. SECURITY MANAGEMENT • The operating system uses password protection to protect user data and similar other techniques. • it also prevents unauthorized access to programs and user data. • The operating system provides various techniques which assure the integrity and confidentiality of user data. The following security measures are used to protect user data: • Protection against unauthorized access through login. • Protection against intrusion by keeping the firewall active. • Protecting the system memory against malicious access. • Displaying messages related to system vulnerabilities.
  • 18. ERROR-DETECTING AIDS • The operating system constantly monitors the system to detect errors and avoid malfunctioning computer systems. • From time to time, the operating system checks the system for any external threat or malicious software activity. • It also checks the hardware for any type of damage. This process displays several alerts to the user so that the appropriate action can be taken against any damage caused to the system.
  • 19. VIRTUAL MACHINES • A virtual machine (VM) is a software-based emulation of a physical computer. It allows you to run multiple operating systems on a single physical machine, enabling greater flexibility, resource utilization, and isolation. • Virtualization technology is widely used in data centers, development environments, and testing scenarios.
  • 20. VIRTUAL MACHINES WITH AN EXAMPLE: 1. Hypervisor: • A hypervisor, also known as a Virtual Machine Monitor (VMM), is a crucial component that manages and allocates resources for virtual machines. There are two types of hypervisors: • Type 1 (bare-metal) runs directly on the hardware, while • Type 2 (hosted) runs on top of an operating system. 2. Virtualization Layer: • The virtualization layer abstracts the physical hardware and creates virtual resources that can be allocated to virtual machines. This layer is managed by the hypervisor.
  • 21. 3. Virtual Machines: •Virtual machines are instances of emulated computers running on a host machine. •Each VM has its own virtual hardware, including a virtual CPU, memory, storage, and network interfaces.
  • 22. Example: •Let's say you have a powerful server with a hypervisor installed, such as VMware vSphere (a popular Type 1 hypervisor). You want to run multiple operating systems on this server. •Step 1: Hypervisor Installation • Install the hypervisor on the physical server. •Step 2: Virtual Machine Creation • Use the hypervisor's management interface to create virtual machines. For example, you decide to create two VMs: one running Windows Server and another running Linux. •Step 3: Resource Allocation • Specify the amount of CPU cores, RAM, and storage each VM should have. The hypervisor ensures that these resources are isolated and allocated to the respective VMs.
  • 23. Step 4: Operating System Installation •Install the operating systems (Windows Server and Linux) on each virtual machine as if they were running on physical hardware. Step 5: Running Multiple OSes Simultaneously •Now, you can run both virtual machines simultaneously on the same physical server. Each VM operates independently, and the hypervisor ensures that they don't interfere with each other. Benefits of Virtual Machines: •Isolation: VMs are isolated from each other, preventing one VM from affecting others. •Resource Utilization: Multiple VMs can share the same physical resources efficiently. •Flexibility: VMs can be easily moved, copied, or modified, providing flexibility in managing and deploying software. Virtual machines are a fundamental technology in modern computing, providing a versatile and efficient way to utilize hardware resources.
  • 24. INTRODUCTION TO LINUX OS • Linux is an operating system, similar to Windows or macOS, but it's open-source, meaning that its source code is freely available for anyone to view, modify, and distribute. 1.What is Linux? • Linux is an operating system, the software that manages all the hardware and software resources on your computer. It's part of a family of free and open-source operating systems based on the Linux kernel. 2.Open Source: • Linux is open source, which means that its source code is accessible to everyone. This encourages collaboration and allows users to customize and improve the system.
  • 25. 3.Distributions (Distros): • Different versions of Linux are packaged and distributed by various organizations or communities. These versions are called distributions or distros. Examples include Ubuntu, Fedora, and Debian. 4.Graphical User Interface (GUI) vs. Command Line Interface (CLI): • Linux provides both a graphical desktop environment (similar to Windows or macOS) and a command-line interface (text-based). Users can choose the interface that suits them best. 5. Multitasking and Multiuser: • Linux supports multitasking, allowing you to run multiple applications simultaneously. It's also a multiuser system, meaning multiple users can log in and use the system concurrently.
  • 26. 6. File System: • Linux uses a hierarchical file system, organizing files and directories in a tree-like structure. The root directory ("/") is the top-level directory. 7. Terminal and Commands: • The command-line interface, accessed through a terminal, allows users to interact with the system using commands. Commands are typed in text form to perform various tasks like file manipulation, system configuration, and software installation. 8. Package Management: • Linux uses package management systems to install, update, and remove software. Users can easily install new applications and keep the system up to date using package managers like apt, yum, or dnf.
  • 27. 9. Security: 1. Linux is known for its security features. Users operate with different levels of permissions, and the system has robust security mechanisms to protect against malware and unauthorized access. 10. Servers and Embedded Systems: 1. Linux is widely used for servers, running the backbone of the internet and hosting various services. It's also prevalent in embedded systems, like routers and smart devices. In summary, Linux is an open-source operating system that provides users with a choice of interfaces, powerful command-line capabilities, and a robust and secure environment. It's versatile and used in various applications, from personal computers to servers and embedded systems.
  • 29. 1. Kernel: 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.
  • 30. 2. System Library: System libraries are some predefined functions by using which any application programs or system utilities can access kernel’s features. These libraries are the foundation upon which any software can be built. Some of the most common system libraries are: 1.GNU C library: This is the C library that provides the most fundamental system for the interface and execution of C programs. This provides may in-built functions for the execution. 2.libpthread (POSIX Threads): This library plays important role for multithreading in Linux, it allows users for creating and managing multiple threads. 3.libdl (Dynamic Linker): This library is responsible for the loading and linking file at the runtime. 4.libm (Math Library): This library provides user with all kind of mathematical function and their execution.
  • 31. 3. Shell: It is an interface among the kernel and user. It can afford the services of kernel. It can take commands through the user and runs the functions of the kernel. The shell is available in distinct types of OSes. These operating systems are categorized into two different types, which are the graphical shells and command- line shells. The graphical line shells facilitate the graphical user interface, while the command line shells facilitate the command line interface. Thus, both of these shells implement operations. However, the graphical user interface shells work slower as compared to the command-line interface shells. There are a few types of these shells which are categorized as follows: •Korn shell •Bourne shell •C shell •POSIX shell
  • 32. 4. Hardware Layer: Hardware layer of Linux is the lowest level of operating system track. It is plays a vital role in managing all the hardware components. It includes device drivers, kernel functions, memory management, CPU control, and I/O operations. This layer generalizes hard complexity, by providing an interface for software by assuring proper functionality of all the components.
  • 33. 5. System utility: System utilities are the command line tools that preforms various tasks provided by user to make system management and administration better. These utilities enables user to perform different tasks, such as file management, system monitoring, network configuration, user management etc.
  • 34. BASH SHELL SCRIPTING • Bash Script: • A Bash Shell Script is a plain text file containing a set of various commands that we usually type in the command line. It is used to automate repetitive tasks on Linux filesystem. It might include a set of commands, or a single command, or it might contain the hallmarks of imperative programming like loops, functions, conditional constructs, etc. Effectively, a Bash script is a computer program written in the Bash programming language.
  • 35. HOW TO CREATE AND RUN A BASH SCRIPT? 1. Create the Bash Script: • Open a text editor (like nano, vim, emacs, or even a graphical text editor like gedit). • Write your Bash script in the editor. For example, let's create a simple script named myscript.sh: #!/bin/bash echo "Hello, this is my Bash script!“ • Save file with .sh extension (myscript.sh)
  • 36. 2. MAKE THE SCRIPT EXECUTABLE: • In order to run the script, you need to make it executable. Open a terminal and use the chmod command: • chmod +x myscript.sh • In the context of the chmod command, the +x flag is used to add the execute permission to a file. Here's what each part of the command means: • chmod: This is the command to change file permissions in Unix-like operating systems. • +x: This flag specifies that you want to add the execute permission. The letter x stands for execute. • myscript.sh: This is the name of the file for which you want to modify permissions. So, chmod +x myscript.sh means you are adding execute permission to the file
  • 37. 3.RUN THE BASH SCRIPT: • You can now execute your script using ./ followed by the script name: ./myscript.sh • Alternative Ways to Run the Script: you can also run the script using the bash command: bash myscript.sh • Or by using the source command: source myscript.sh
  • 38. BASH COMMANDS 1. Echo and Variables: # Echo command echo "Hello,World!" #Variables name="John" echo "My name is $name"
  • 39. 2. USER INPUT • # Reading user input • echo -n "Enter your name: " • read username • echo "Hello, $username!"
  • 40. 3. CONDITIONAL STATEMENTS (IF-ELSE): • # Conditional statement • if [ "$name" == "John" ]; then • echo "You are John." • else • echo "You are not John." • fi
  • 41. 4. LOOPS (FOR LOOP): • # Conditional statement • if [ "$name" == "John" ]; then • echo "You are John." • else • echo "You are not John." • fi
  • 42. 5. FUNCTIONS: • # Function definition • greet() { • echo "Hello, $1!" • } • # Function call • greet "Alice"
  • 43. 6. CONDITIONAL STATEMENTS (CASE): *) echo "Unknown fruit." ;; esac # Case statement fruit="apple“ case $fruit in "apple") echo "It's an apple." ;; "banana") echo "It's a banana." ;;
  • 44. 7.FILE OPERATIONS: • # Creating a file touch newfile.txt • # Writing to a file echo "This is some text." > newfile.txt • # Appending to a file echo "More text." >> newfile.txt • # Reading from a file content=$(cat newfile.txt) echo "File content: $content"
  • 45. • Redirect to a File (>): The > operator is used to redirect standard output to a file. If the file doesn't exist, it will be created. If it already exists, its contents will be overwritten. command > output.txt • Append to a File (>>): The >> operator is similar to >, but it appends the output to the end of the file instead of overwriting the file. command >> output.txt