Unix / Linux Operating System
Department of Computer Science (UG)
Operating System and Linux
(21BCA2T343)
Dr.Poongothai P
Assistant Professor
Department of Computer Science (UG)
Kristu Jayanti College (Autonomous)
Bengaluru.
 The Unix operating system is a set of programs that act
as a link between the computer and the user.
 The computer programs that allocate the system
resources and coordinate all the details of the
computer's internals is called the operating system or
the kernel.
 Users communicate with the kernel through a program
known as the shell.
 The shell is a command line interpreter; it translates
commands entered by the user and converts them into a
language that is understood by the kernel.
 UNIX is a powerful Operating System initially
developed by Ken Thompson, Dennis Ritchie at AT&T
Bell laboratories in 1970.
 In UNIX, the file system is a hierarchical structure of
files and directories where users can store and retrieve
information using the files.
 Several people can use a Unix computer at the same
time; hence Unix is called a multiuser system.
Unix Operating system
Features of UNIX Operating System
Unix Architecture
 Kernel − The kernel is the heart of the operating system. It
interacts with the hardware and most of the tasks like memory
management, task scheduling and file management.
 Shell − The shell is the utility that processes your requests.
When you type in a command at your terminal, the shell
interprets the command and calls the program that you want.
 Commands and Utilities − There are various commands and
utilities which you can make use of in your day to day
activities. cp, mv, etc. are few examples of commands and
utilities
 Files and Directories − All the data of Unix is organized into
files. All files are then organized into directories. These
directories are further organized into a tree-like structure
called the filesystem.
 When a computer starts running or reboots to get an
instance, it needs an initial program to run. This initial
program is known as the bootstrap program, and it
must initialize all aspects of the system, such as:
 First, initializes the CPU registers, device controllers,
main memory, and then starts the operating system.
 The bootstrap program finds the operating system
kernel on disk to do its job and then loads that kernel
into memory.
 And last jumps to the initial address to begin the
operating-system execution.
Boot Block
 The superblock is essentially file system metadata and
defines the file system type, size, status, and
information about other metadata structures (metadata
of metadata).
 Superblocks also stores configuration of the file
system.
 Some higher level details that is stored in superblock is
mentioned below.
 Blocks in the file system, No of free blocks in the file
system, Inodes per block group, Blocks per block
group, Mount time, Write time and File System State
Super block
 An inode is a data structure in UNIX operating
systems that contains important information
pertaining to files within a file system.
 When a file system is created in UNIX, a set
amount of inodes is created, as well.
 Whenever a user or a program needs access to a
file, the operating system first searches for the exact
and unique inode (inode number), in a table called
as an inode table.
 In fact the program or the user who needs access to
a file, reaches the file with the help of the inode
number found from the inode table.
Inode table
 An inode can directly or indirectly reference
three kinds of data blocks.
 All referenced blocks must be of the same
kind.
The three types of data blocks are:
 Plain data blocks
 Symbolic-link data blocks
 Directory data blocks
Data block
 Plain data blocks contain the information stored in a
file.
 Symbolic-link data blocks contain the path name
stored in a symbolic link.
 Directory data blocks contain directory
entries. fsck can check the validity only of directory
data blocks.
(The fsck command checks the general connectivity
of the file system)
 All Unix disk files are stored in one directory
tree.
 This includes both system files and user files.
 The files are grouped in directories, which are
simply collections of files and/or more
directories.
Storing and accessing file
 File ownership is an important component of Unix that
provides a secure method for storing files. Every file in
Unix has the following attributes −
 Owner permissions − The owner's permissions
determine what actions the owner of the file can
perform on the file.
 Group permissions − The group's permissions
determine what actions a user, who is a member of the
group that a file belongs to, can perform on the file.
 Other (world) permissions − The permissions for
others indicate what action all other users can perform
on the file.
 The permissions of a file are the first line of defense
in the security of a Unix system.
 The basic building blocks of Unix permissions are
the read, write, and execute permissions, which have
been described below −
Read: Grants the capability to read, i.e., view the
contents of the file.
Write: Grants the capability to modify, or remove the
content of the file.
Execute: User with execute permissions can run a file
as a program.
File Access Modes
 Directory access modes are listed and organized in the
same manner as any other file.
 There are a few differences that need to be mentioned
Read: Access to a directory means that the user can read
the contents. The user can look at the filenames inside
the directory.
Write: Access means that the user can add or delete files
from the directory.
Execute: Executing a directory doesn't really make sense,
so think of this as a traverse permission (passthrough).
Directory Access Modes
pwd Command
 The pwd command is used to display the location of
the current working directory.
Syntax:
 pwd
Output:
Directory commands
mkdir Command
 The mkdir command is used to create a new directory
under any directory.
Syntax: mkdir <directory name>
Output:
rmdir Command
 The rmdir command is used to delete a directory.
 Syntax: rmdir <directory name>
 Output:
ls Command
 The ls command is used to display a list of content of a
directory.
 Syntax:
ls
 Output:
cd Command
 The cd command is used to change the current
directory.
Syntax:
 cd <directory name>
Output:
S.No Command & Description
1 cat filename - Displays a filename
2 cd dirname - Moves you to the identified directory
3 cp file1 file2 - Copies one file/directory to the specified location
4 file filename - Identifies the file type (binary, text, etc)
5 find filename dir - Finds a file/directory
6 head filename - Shows the beginning of a file
7 less filename - Browses through a file from the end or the beginning
8 ls dirname -Shows the contents of the directory specified
9 mkdir dirname - Creates the specified directory
File commands
10 more filename
Browses through a file from the beginning to the end
11 mv file1 file2
Moves the location of, or renames a file/directory
12 pwd
Shows the current directory the user is in
13 rm filename
Removes a file
 The ‘pipe’ command is used in both UNIX and Linux
operating systems.
 Pipes help combine two or more commands and are
used as input/output concepts in a command.
 In the Linux operating system, we use more than one
pipe in command so that the output of one command
before a pipe acts as input for the other command after
the pipe.
Syntax
 Command 1 | command 2 | command 3 | ……
Pipe and pipeline
 Suppose we have a file named file1.txt having
the names of the students.
 We have used the cat command to fetch the
record of that file.
$ Cat file1.txt
 The data present in this file is unordered.
 So, to sort the data, we need to follow a piece
of code here.
$ Cat file1.txt | sort
 Now we will use the command to remove all
the words that are duplicated in the file.
$ Cat file2.txt | sort | uniq
 we will use the below-cited command to save
them.
$ cat file2.txt | sort | uniq > list4.txt
The output will be saved in another file with the
same extension.
 in this example, we have declared the range up
to 4.
 So the data will be from the first 4 lines of the
file.
 Consider the same file file2.txt as we have
taken an example above.
$ Cat file2.txt | head -4
 Process control commands are the system calls
for creating, managing, and coordinating
processes.
Process control commands in Unix are:
 bg - put suspended process into background
 fg - bring process into foreground
 jobs - list processes
Process control
 The fork() function is used to create a new process by
duplicating the existing process from which it is
called.
 The existing process from which this function is
called becomes the parent process and the newly
created process becomes the child process.
FORK
 exit-Issuing the exit command at the shell prompt
will cause the shell to exit.
EXAMPLE-1:
To exit from shell:
$ exit
output:
# su ubuntu
EXIT
 In order to wait for a child process to
terminate, a parent process will just execute
a wait() system call.
 Wait for a child process to end
 The wait() system call suspends execution of
the current process until one of its children
terminates.
WAIT
 The exec() system call is used to make the
processes.
 When the exec() function is used, the currently
running process is terminated and replaced
with the newly formed process.
 In other words, only the new process persists
after calling exec(). The parent process is shut
down.
Exec
 The functions which change the execution mode of
the program from user mode to kernel mode are
known as system calls.
 System calls in Unix are used for file system
control, process control, interprocess
communication etc.
 Access to the Unix kernel is only available through
these system calls.
Unix system calls
System Call Description
access() This checks if a calling process has access to
the required file
chdir() The chdir command changes the current
directory of the system
chmod() The mode of a file can be changed using this
command
chown() This changes the ownership of a particular
file
kill() This system call sends kill signal to one or
more processes
link() A new file name is linked to an existing file
using link system call.
open() This opens a file for the reading or writing
process
pause() The pause call suspends a file until a
particular signal occurs.
stime() This system call sets the correct time.
times() Gets the parent and child process
times
alarm() The alarm system call sets the alarm
clock of a process
fork() A new process is created using this
command
chroot() This changes the root directory of a
file.
exit() The exit system call is used to exit a
process.
 Library functions typically provide a richer set of
features.
 For example, the fread() library function reads a
number of elements of data of specified size from a
file.
 While presenting this formatted data to the user,
internally it will call the read() system call to actually
read data from the file.
Library Functions

More Related Content

PPTX
Shells commands, file structure, directory structure.pptx
PPTX
Introduction to Unix
PPTX
Unix_Introduction_BCA.pptx the very basi
PPTX
UNIX.pptx
PPTX
Chapter 2 Introduction to Unix Concepts
PDF
Introduction to Unix-like systems (Part I-IV)
PPTX
Rishav Mishra final presentation on UNIX Final.pptx
PPTX
Unix Shell Script - 2 Days Session.pptx
Shells commands, file structure, directory structure.pptx
Introduction to Unix
Unix_Introduction_BCA.pptx the very basi
UNIX.pptx
Chapter 2 Introduction to Unix Concepts
Introduction to Unix-like systems (Part I-IV)
Rishav Mishra final presentation on UNIX Final.pptx
Unix Shell Script - 2 Days Session.pptx

Similar to Unix / Linux Operating System introduction. (20)

PPTX
Unix/Linux
PPTX
Linux powerpoint
PPT
Karkha unix shell scritping
PPT
PowerPoint_merge.ppt on unix programming
PPT
2ab. UNIX files.ppt JSS science and technology university
PDF
AOS Lab 1: Hello, Linux!
PPTX
Unix operating system architecture with file structure
PPT
Module1-UNIX architecture; FEATURES OF UNIX OS
PPT
Online Training in Unix Linux Shell Scripting in Hyderabad
PPTX
unix details file system, architecture, directory
PPTX
Operating systems unix
PPTX
Operating system
PDF
PPSX
Unix environment [autosaved]
PPS
QSpiders - Unix Operating Systems and Commands
PPT
Shell_Scripting.ppt
PDF
Unix and Linux - The simple introduction
PPT
Spsl unit1
PDF
Linux Notes-1.pdf
PPTX
Commands and shell programming (3)
Unix/Linux
Linux powerpoint
Karkha unix shell scritping
PowerPoint_merge.ppt on unix programming
2ab. UNIX files.ppt JSS science and technology university
AOS Lab 1: Hello, Linux!
Unix operating system architecture with file structure
Module1-UNIX architecture; FEATURES OF UNIX OS
Online Training in Unix Linux Shell Scripting in Hyderabad
unix details file system, architecture, directory
Operating systems unix
Operating system
Unix environment [autosaved]
QSpiders - Unix Operating Systems and Commands
Shell_Scripting.ppt
Unix and Linux - The simple introduction
Spsl unit1
Linux Notes-1.pdf
Commands and shell programming (3)
Ad

More from poongothai11 (10)

PPTX
Data Structures Stack and Queue Data Structures
PPTX
Introduction to Database Management Systems
PDF
Open System Interconnection model and its layers.pdf
PPTX
Computer Organization Introduction, Generations of Computer.pptx
PDF
C Programming Language Introduction and C Tokens.pdf
PPTX
Stack and its operations, Queue and its operations
PPTX
Searching and Sorting Algorithms in Data Structures
PPTX
Thread Concept: Multithreading, Creating thread using thread
PPTX
Exception Handling Multithreading: Fundamental of Exception; Exception types;...
PPTX
Introduction to Data Structures, Data Structures using C.pptx
Data Structures Stack and Queue Data Structures
Introduction to Database Management Systems
Open System Interconnection model and its layers.pdf
Computer Organization Introduction, Generations of Computer.pptx
C Programming Language Introduction and C Tokens.pdf
Stack and its operations, Queue and its operations
Searching and Sorting Algorithms in Data Structures
Thread Concept: Multithreading, Creating thread using thread
Exception Handling Multithreading: Fundamental of Exception; Exception types;...
Introduction to Data Structures, Data Structures using C.pptx
Ad

Recently uploaded (20)

PPTX
Spectroscopic Techniques for M Tech Civil Engineerin .pptx
PPTX
endocrine - management of adrenal incidentaloma.pptx
PPTX
Substance Disorders- part different drugs change body
PPTX
GREEN FIELDS SCHOOL PPT ON HOLIDAY HOMEWORK
PPTX
Cells and Organs of the Immune System (Unit-2) - Majesh Sir.pptx
PPTX
Understanding the Circulatory System……..
PPTX
Toxicity Studies in Drug Development Ensuring Safety, Efficacy, and Global Co...
PPT
Biochemestry- PPT ON Protein,Nitrogenous constituents of Urine, Blood, their ...
PDF
The Future of Telehealth: Engineering New Platforms for Care (www.kiu.ac.ug)
PPTX
TORCH INFECTIONS in pregnancy with toxoplasma
PDF
Integrative Oncology: Merging Conventional and Alternative Approaches (www.k...
PDF
Chapter 3 - Human Development Poweroint presentation
PPTX
A powerpoint on colorectal cancer with brief background
PPTX
LIPID & AMINO ACID METABOLISM UNIT-III, B PHARM II SEMESTER
PDF
Metabolic Acidosis. pa,oakw,llwla,wwwwqw
PDF
Sumer, Akkad and the mythology of the Toradja Sa'dan.pdf
PPTX
limit test definition and all limit tests
PPTX
BPharm_Hospital_Organization_Complete_PPT.pptx
PPTX
Introduction to Immunology (Unit-1).pptx
PPTX
Platelet disorders - thrombocytopenia.pptx
Spectroscopic Techniques for M Tech Civil Engineerin .pptx
endocrine - management of adrenal incidentaloma.pptx
Substance Disorders- part different drugs change body
GREEN FIELDS SCHOOL PPT ON HOLIDAY HOMEWORK
Cells and Organs of the Immune System (Unit-2) - Majesh Sir.pptx
Understanding the Circulatory System……..
Toxicity Studies in Drug Development Ensuring Safety, Efficacy, and Global Co...
Biochemestry- PPT ON Protein,Nitrogenous constituents of Urine, Blood, their ...
The Future of Telehealth: Engineering New Platforms for Care (www.kiu.ac.ug)
TORCH INFECTIONS in pregnancy with toxoplasma
Integrative Oncology: Merging Conventional and Alternative Approaches (www.k...
Chapter 3 - Human Development Poweroint presentation
A powerpoint on colorectal cancer with brief background
LIPID & AMINO ACID METABOLISM UNIT-III, B PHARM II SEMESTER
Metabolic Acidosis. pa,oakw,llwla,wwwwqw
Sumer, Akkad and the mythology of the Toradja Sa'dan.pdf
limit test definition and all limit tests
BPharm_Hospital_Organization_Complete_PPT.pptx
Introduction to Immunology (Unit-1).pptx
Platelet disorders - thrombocytopenia.pptx

Unix / Linux Operating System introduction.

  • 1. Unix / Linux Operating System Department of Computer Science (UG) Operating System and Linux (21BCA2T343) Dr.Poongothai P Assistant Professor Department of Computer Science (UG) Kristu Jayanti College (Autonomous) Bengaluru.
  • 2.  The Unix operating system is a set of programs that act as a link between the computer and the user.  The computer programs that allocate the system resources and coordinate all the details of the computer's internals is called the operating system or the kernel.  Users communicate with the kernel through a program known as the shell.  The shell is a command line interpreter; it translates commands entered by the user and converts them into a language that is understood by the kernel.
  • 3.  UNIX is a powerful Operating System initially developed by Ken Thompson, Dennis Ritchie at AT&T Bell laboratories in 1970.  In UNIX, the file system is a hierarchical structure of files and directories where users can store and retrieve information using the files.  Several people can use a Unix computer at the same time; hence Unix is called a multiuser system. Unix Operating system
  • 4. Features of UNIX Operating System
  • 6.  Kernel − The kernel is the heart of the operating system. It interacts with the hardware and most of the tasks like memory management, task scheduling and file management.  Shell − The shell is the utility that processes your requests. When you type in a command at your terminal, the shell interprets the command and calls the program that you want.  Commands and Utilities − There are various commands and utilities which you can make use of in your day to day activities. cp, mv, etc. are few examples of commands and utilities  Files and Directories − All the data of Unix is organized into files. All files are then organized into directories. These directories are further organized into a tree-like structure called the filesystem.
  • 7.  When a computer starts running or reboots to get an instance, it needs an initial program to run. This initial program is known as the bootstrap program, and it must initialize all aspects of the system, such as:  First, initializes the CPU registers, device controllers, main memory, and then starts the operating system.  The bootstrap program finds the operating system kernel on disk to do its job and then loads that kernel into memory.  And last jumps to the initial address to begin the operating-system execution. Boot Block
  • 8.  The superblock is essentially file system metadata and defines the file system type, size, status, and information about other metadata structures (metadata of metadata).  Superblocks also stores configuration of the file system.  Some higher level details that is stored in superblock is mentioned below.  Blocks in the file system, No of free blocks in the file system, Inodes per block group, Blocks per block group, Mount time, Write time and File System State Super block
  • 9.  An inode is a data structure in UNIX operating systems that contains important information pertaining to files within a file system.  When a file system is created in UNIX, a set amount of inodes is created, as well.  Whenever a user or a program needs access to a file, the operating system first searches for the exact and unique inode (inode number), in a table called as an inode table.  In fact the program or the user who needs access to a file, reaches the file with the help of the inode number found from the inode table. Inode table
  • 10.  An inode can directly or indirectly reference three kinds of data blocks.  All referenced blocks must be of the same kind. The three types of data blocks are:  Plain data blocks  Symbolic-link data blocks  Directory data blocks Data block
  • 11.  Plain data blocks contain the information stored in a file.  Symbolic-link data blocks contain the path name stored in a symbolic link.  Directory data blocks contain directory entries. fsck can check the validity only of directory data blocks. (The fsck command checks the general connectivity of the file system)
  • 12.  All Unix disk files are stored in one directory tree.  This includes both system files and user files.  The files are grouped in directories, which are simply collections of files and/or more directories. Storing and accessing file
  • 13.  File ownership is an important component of Unix that provides a secure method for storing files. Every file in Unix has the following attributes −  Owner permissions − The owner's permissions determine what actions the owner of the file can perform on the file.  Group permissions − The group's permissions determine what actions a user, who is a member of the group that a file belongs to, can perform on the file.  Other (world) permissions − The permissions for others indicate what action all other users can perform on the file.
  • 14.  The permissions of a file are the first line of defense in the security of a Unix system.  The basic building blocks of Unix permissions are the read, write, and execute permissions, which have been described below − Read: Grants the capability to read, i.e., view the contents of the file. Write: Grants the capability to modify, or remove the content of the file. Execute: User with execute permissions can run a file as a program. File Access Modes
  • 15.  Directory access modes are listed and organized in the same manner as any other file.  There are a few differences that need to be mentioned Read: Access to a directory means that the user can read the contents. The user can look at the filenames inside the directory. Write: Access means that the user can add or delete files from the directory. Execute: Executing a directory doesn't really make sense, so think of this as a traverse permission (passthrough). Directory Access Modes
  • 16. pwd Command  The pwd command is used to display the location of the current working directory. Syntax:  pwd Output: Directory commands
  • 17. mkdir Command  The mkdir command is used to create a new directory under any directory. Syntax: mkdir <directory name> Output:
  • 18. rmdir Command  The rmdir command is used to delete a directory.  Syntax: rmdir <directory name>  Output:
  • 19. ls Command  The ls command is used to display a list of content of a directory.  Syntax: ls  Output:
  • 20. cd Command  The cd command is used to change the current directory. Syntax:  cd <directory name> Output:
  • 21. S.No Command & Description 1 cat filename - Displays a filename 2 cd dirname - Moves you to the identified directory 3 cp file1 file2 - Copies one file/directory to the specified location 4 file filename - Identifies the file type (binary, text, etc) 5 find filename dir - Finds a file/directory 6 head filename - Shows the beginning of a file 7 less filename - Browses through a file from the end or the beginning 8 ls dirname -Shows the contents of the directory specified 9 mkdir dirname - Creates the specified directory File commands
  • 22. 10 more filename Browses through a file from the beginning to the end 11 mv file1 file2 Moves the location of, or renames a file/directory 12 pwd Shows the current directory the user is in 13 rm filename Removes a file
  • 23.  The ‘pipe’ command is used in both UNIX and Linux operating systems.  Pipes help combine two or more commands and are used as input/output concepts in a command.  In the Linux operating system, we use more than one pipe in command so that the output of one command before a pipe acts as input for the other command after the pipe. Syntax  Command 1 | command 2 | command 3 | …… Pipe and pipeline
  • 24.  Suppose we have a file named file1.txt having the names of the students.  We have used the cat command to fetch the record of that file. $ Cat file1.txt
  • 25.  The data present in this file is unordered.  So, to sort the data, we need to follow a piece of code here. $ Cat file1.txt | sort
  • 26.  Now we will use the command to remove all the words that are duplicated in the file. $ Cat file2.txt | sort | uniq
  • 27.  we will use the below-cited command to save them. $ cat file2.txt | sort | uniq > list4.txt The output will be saved in another file with the same extension.  in this example, we have declared the range up to 4.  So the data will be from the first 4 lines of the file.  Consider the same file file2.txt as we have taken an example above. $ Cat file2.txt | head -4
  • 28.  Process control commands are the system calls for creating, managing, and coordinating processes. Process control commands in Unix are:  bg - put suspended process into background  fg - bring process into foreground  jobs - list processes Process control
  • 29.  The fork() function is used to create a new process by duplicating the existing process from which it is called.  The existing process from which this function is called becomes the parent process and the newly created process becomes the child process. FORK
  • 30.  exit-Issuing the exit command at the shell prompt will cause the shell to exit. EXAMPLE-1: To exit from shell: $ exit output: # su ubuntu EXIT
  • 31.  In order to wait for a child process to terminate, a parent process will just execute a wait() system call.  Wait for a child process to end  The wait() system call suspends execution of the current process until one of its children terminates. WAIT
  • 32.  The exec() system call is used to make the processes.  When the exec() function is used, the currently running process is terminated and replaced with the newly formed process.  In other words, only the new process persists after calling exec(). The parent process is shut down. Exec
  • 33.  The functions which change the execution mode of the program from user mode to kernel mode are known as system calls.  System calls in Unix are used for file system control, process control, interprocess communication etc.  Access to the Unix kernel is only available through these system calls. Unix system calls
  • 34. System Call Description access() This checks if a calling process has access to the required file chdir() The chdir command changes the current directory of the system chmod() The mode of a file can be changed using this command chown() This changes the ownership of a particular file kill() This system call sends kill signal to one or more processes link() A new file name is linked to an existing file using link system call. open() This opens a file for the reading or writing process pause() The pause call suspends a file until a particular signal occurs.
  • 35. stime() This system call sets the correct time. times() Gets the parent and child process times alarm() The alarm system call sets the alarm clock of a process fork() A new process is created using this command chroot() This changes the root directory of a file. exit() The exit system call is used to exit a process.
  • 36.  Library functions typically provide a richer set of features.  For example, the fread() library function reads a number of elements of data of specified size from a file.  While presenting this formatted data to the user, internally it will call the read() system call to actually read data from the file. Library Functions