SlideShare a Scribd company logo
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
Ad

Recommended

Shells commands, file structure, directory structure.pptx
Shells commands, file structure, directory structure.pptx
SherinRappai
 
Introduction to Unix
Introduction to Unix
Nishant Munjal
 
18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma
perweeng31
 
Operating system
Operating system
HarshithaAllu
 
Rishav Mishra final presentation on UNIX Final.pptx
Rishav Mishra final presentation on UNIX Final.pptx
rishavmishra041
 
managing-the-linux-file-system_suse_.ppt
managing-the-linux-file-system_suse_.ppt
submarinoaguadulce1
 
managing-the-linux-file-system________________________
managing-the-linux-file-system________________________
saurabhbquest
 
linux-file-system01.ppt
linux-file-system01.ppt
MeesanRaza
 
84640411 study-of-unix-os
84640411 study-of-unix-os
homeworkping3
 
Linux 4 you
Linux 4 you
Shashwat Shriparv
 
Programming Embedded linux
Programming Embedded linux
Liran Ben Haim
 
Linux Notes-1.pdf
Linux Notes-1.pdf
asif64436
 
Karkha unix shell scritping
Karkha unix shell scritping
chockit88
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
MeenalJabde
 
Linux Presentation
Linux Presentation
Muhammad Qazi
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
sbmguys
 
linux-lecture1.ppt
linux-lecture1.ppt
Nikhil Raut
 
Unix Administration
Unix Administration
Nishant Munjal
 
UNIX.pptx
UNIX.pptx
P S Rani
 
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
pssafvan97
 
Tutorial 2
Tutorial 2
tech2click
 
MODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptx
ManasaPJ1
 
Linux
Linux
Hemakumar.S
 
Unit 7
Unit 7
siddr
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
Sadia Bashir
 
Unix Operating System
Unix Operating System
subhsikha
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure
amol_chavan
 
16. Computer Systems Basic Software 2
16. Computer Systems Basic Software 2
New Era University
 
Data Structures Stack and Queue Data Structures
Data Structures Stack and Queue Data Structures
poongothai11
 
Introduction to Database Management Systems
Introduction to Database Management Systems
poongothai11
 

More Related Content

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

84640411 study-of-unix-os
84640411 study-of-unix-os
homeworkping3
 
Linux 4 you
Linux 4 you
Shashwat Shriparv
 
Programming Embedded linux
Programming Embedded linux
Liran Ben Haim
 
Linux Notes-1.pdf
Linux Notes-1.pdf
asif64436
 
Karkha unix shell scritping
Karkha unix shell scritping
chockit88
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
MeenalJabde
 
Linux Presentation
Linux Presentation
Muhammad Qazi
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
sbmguys
 
linux-lecture1.ppt
linux-lecture1.ppt
Nikhil Raut
 
Unix Administration
Unix Administration
Nishant Munjal
 
UNIX.pptx
UNIX.pptx
P S Rani
 
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
pssafvan97
 
Tutorial 2
Tutorial 2
tech2click
 
MODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptx
ManasaPJ1
 
Linux
Linux
Hemakumar.S
 
Unit 7
Unit 7
siddr
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
Sadia Bashir
 
Unix Operating System
Unix Operating System
subhsikha
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure
amol_chavan
 
16. Computer Systems Basic Software 2
16. Computer Systems Basic Software 2
New Era University
 
84640411 study-of-unix-os
84640411 study-of-unix-os
homeworkping3
 
Programming Embedded linux
Programming Embedded linux
Liran Ben Haim
 
Linux Notes-1.pdf
Linux Notes-1.pdf
asif64436
 
Karkha unix shell scritping
Karkha unix shell scritping
chockit88
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
MeenalJabde
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
sbmguys
 
linux-lecture1.ppt
linux-lecture1.ppt
Nikhil Raut
 
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
pssafvan97
 
MODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptx
ManasaPJ1
 
Unit 7
Unit 7
siddr
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
Sadia Bashir
 
Unix Operating System
Unix Operating System
subhsikha
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure
amol_chavan
 
16. Computer Systems Basic Software 2
16. Computer Systems Basic Software 2
New Era University
 

More from poongothai11 (10)

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

Recently uploaded (20)

SCIENCE-G7-Quarter1-Week1-Day5.matatagptx
SCIENCE-G7-Quarter1-Week1-Day5.matatagptx
Pyumpyum
 
Algebra A BASIC REVIEW INTERMEDICATE ALGEBRA
Algebra A BASIC REVIEW INTERMEDICATE ALGEBRA
ropamadoda
 
Lecture 9 Natural selection Evolution.pptx
Lecture 9 Natural selection Evolution.pptx
madi34702
 
8,9-Red Blood Cells.pdf ayurveda for life
8,9-Red Blood Cells.pdf ayurveda for life
AnkitBhardwaj874048
 
Climate and Weather_Science 9_Q3_PH.pptx
Climate and Weather_Science 9_Q3_PH.pptx
Dayan Espartero
 
Solution Chemistry Basics, molarity Molality
Solution Chemistry Basics, molarity Molality
nuralam819365
 
Properties of Gases siwhdhadpaldndn.pptx
Properties of Gases siwhdhadpaldndn.pptx
CatherineJadeBurce
 
GBSN_ Unit 1 - Introduction to Microbiology
GBSN_ Unit 1 - Introduction to Microbiology
Areesha Ahmad
 
Introductory Material for Markov-chain Description of Abzymes Catalysis
Introductory Material for Markov-chain Description of Abzymes Catalysis
Orchidea Maria Lecian
 
Science Experiment: Properties of Water.pptx
Science Experiment: Properties of Water.pptx
marionrada1985
 
The Emergence of Signatures of AGI: The Physics of Learning
The Emergence of Signatures of AGI: The Physics of Learning
Charles Martin
 
Pushkar camel fest at college campus placement
Pushkar camel fest at college campus placement
nandanitiwari82528
 
Pathophysiology_Unit1_BPharm CELL INJURY
Pathophysiology_Unit1_BPharm CELL INJURY
KRUTIKA CHANNE
 
GB1 Q1W1S1- Cell Theory General Biology 1
GB1 Q1W1S1- Cell Theory General Biology 1
KeannoRod1
 
Cloud Collaboration Market Challenges, Drivers, Trends, and Forecast by 2031
Cloud Collaboration Market Challenges, Drivers, Trends, and Forecast by 2031
moresonali406
 
TISSUE TRANSPLANTATTION and IT'S IMPORTANCE IS DISCUSSED
TISSUE TRANSPLANTATTION and IT'S IMPORTANCE IS DISCUSSED
PhoebeAkinyi1
 
Introduction to Microbiology and Microscope
Introduction to Microbiology and Microscope
vaishrawan1
 
Cryptocurrency and cyber crime Presentation
Cryptocurrency and cyber crime Presentation
IqraRehaman
 
Gas Exchange in Insects and structures 01
Gas Exchange in Insects and structures 01
PhoebeAkinyi1
 
pollination njnjnjnjnjnjjnjnjnjnjnjnjnnj
pollination njnjnjnjnjnjjnjnjnjnjnjnjnnj
bhg31shagnik
 
SCIENCE-G7-Quarter1-Week1-Day5.matatagptx
SCIENCE-G7-Quarter1-Week1-Day5.matatagptx
Pyumpyum
 
Algebra A BASIC REVIEW INTERMEDICATE ALGEBRA
Algebra A BASIC REVIEW INTERMEDICATE ALGEBRA
ropamadoda
 
Lecture 9 Natural selection Evolution.pptx
Lecture 9 Natural selection Evolution.pptx
madi34702
 
8,9-Red Blood Cells.pdf ayurveda for life
8,9-Red Blood Cells.pdf ayurveda for life
AnkitBhardwaj874048
 
Climate and Weather_Science 9_Q3_PH.pptx
Climate and Weather_Science 9_Q3_PH.pptx
Dayan Espartero
 
Solution Chemistry Basics, molarity Molality
Solution Chemistry Basics, molarity Molality
nuralam819365
 
Properties of Gases siwhdhadpaldndn.pptx
Properties of Gases siwhdhadpaldndn.pptx
CatherineJadeBurce
 
GBSN_ Unit 1 - Introduction to Microbiology
GBSN_ Unit 1 - Introduction to Microbiology
Areesha Ahmad
 
Introductory Material for Markov-chain Description of Abzymes Catalysis
Introductory Material for Markov-chain Description of Abzymes Catalysis
Orchidea Maria Lecian
 
Science Experiment: Properties of Water.pptx
Science Experiment: Properties of Water.pptx
marionrada1985
 
The Emergence of Signatures of AGI: The Physics of Learning
The Emergence of Signatures of AGI: The Physics of Learning
Charles Martin
 
Pushkar camel fest at college campus placement
Pushkar camel fest at college campus placement
nandanitiwari82528
 
Pathophysiology_Unit1_BPharm CELL INJURY
Pathophysiology_Unit1_BPharm CELL INJURY
KRUTIKA CHANNE
 
GB1 Q1W1S1- Cell Theory General Biology 1
GB1 Q1W1S1- Cell Theory General Biology 1
KeannoRod1
 
Cloud Collaboration Market Challenges, Drivers, Trends, and Forecast by 2031
Cloud Collaboration Market Challenges, Drivers, Trends, and Forecast by 2031
moresonali406
 
TISSUE TRANSPLANTATTION and IT'S IMPORTANCE IS DISCUSSED
TISSUE TRANSPLANTATTION and IT'S IMPORTANCE IS DISCUSSED
PhoebeAkinyi1
 
Introduction to Microbiology and Microscope
Introduction to Microbiology and Microscope
vaishrawan1
 
Cryptocurrency and cyber crime Presentation
Cryptocurrency and cyber crime Presentation
IqraRehaman
 
Gas Exchange in Insects and structures 01
Gas Exchange in Insects and structures 01
PhoebeAkinyi1
 
pollination njnjnjnjnjnjjnjnjnjnjnjnjnnj
pollination njnjnjnjnjnjjnjnjnjnjnjnjnnj
bhg31shagnik
 
Ad

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