SlideShare a Scribd company logo
OS
UNIT 4
 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.
Shells commands, file structure, directory structure.pptx
 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.
Boot Block
 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.
 The superblock is essentially file system metadata and
defines the total inodes and blocks, block size, location
of the inode table and datablock, 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.
Super block
 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
 File System State
 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.
 It stores Metadata about individual files and
directories, File size, owner, permissions,
timestamps, file type
Inode table
 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.
 A data block is the part of the file system where the
actual contents of files and directories are stored.
 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 −
File Access Modes
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.
 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
Directory Access Modes
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).
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:
Sr.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
File commands
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
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.
Pipe and pipeline
Syntax
 Command 1 | command 2 | command 3 | ……
 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
Process control commands in Unix are:
 bg - put suspended process into background
 fg - bring process into foreground
 jobs - list processes
 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
Unix / Linux Operating System introduction.
PPTX
Introduction to Unix
PPTX
18 LINUX OS.pptx Linux command is basic isma
PPTX
Operating system
PPTX
Rishav Mishra final presentation on UNIX Final.pptx
PPT
managing-the-linux-file-system_suse_.ppt
PPT
managing-the-linux-file-system________________________
PPT
linux-file-system01.ppt
Unix / Linux Operating System introduction.
Introduction to Unix
18 LINUX OS.pptx Linux command is basic isma
Operating system
Rishav Mishra final presentation on UNIX Final.pptx
managing-the-linux-file-system_suse_.ppt
managing-the-linux-file-system________________________
linux-file-system01.ppt

Similar to Shells commands, file structure, directory structure.pptx (20)

PPTX
Linux 4 you
DOC
84640411 study-of-unix-os
PPT
Karkha unix shell scritping
PPTX
Chapter 2 Introduction to Unix Concepts
PPTX
Unix operating system architecture with file structure
PPTX
MODULE 3.1 updated-18cs56.pptx
PPTX
UNIX.pptx
PPT
Unix/Linux Basic Commands and Shell Script
PDF
Programming Embedded linux
PPTX
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
DOC
PPTX
Unix Operating System
PPTX
Unix Administration
PPTX
Basic Commands-part1.pptx
PPT
16. Computer Systems Basic Software 2
PPT
Unit 7
PPTX
Unix Shell Script - 2 Days Session.pptx
PPT
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
PDF
Linux introductory-course-day-1
PPT
Tutorial 2
Linux 4 you
84640411 study-of-unix-os
Karkha unix shell scritping
Chapter 2 Introduction to Unix Concepts
Unix operating system architecture with file structure
MODULE 3.1 updated-18cs56.pptx
UNIX.pptx
Unix/Linux Basic Commands and Shell Script
Programming Embedded linux
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
Unix Operating System
Unix Administration
Basic Commands-part1.pptx
16. Computer Systems Basic Software 2
Unit 7
Unix Shell Script - 2 Days Session.pptx
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Linux introductory-course-day-1
Tutorial 2
Ad

More from SherinRappai (20)

PPTX
Shell Programming Language in Operating System .pptx
PPTX
Types of NoSql Database available.pptx
PPTX
Introduction to NoSQL & Features of NoSQL.pptx
PPTX
Clustering, Types of clustering, Types of data
PPTX
Association rule introduction, Market basket Analysis
PPTX
Introduction to Internet, Domain Name System
PPTX
Cascading style sheet, CSS Box model, Table in CSS
PPTX
Numpy in python, Array operations using numpy and so on
PPTX
Functions in python, types of functions in python
PPTX
Extensible markup language ppt as part of Internet Technology
PPTX
Java script ppt from students in internet technology
PPTX
Building Competency and Career in the Open Source World
PPTX
How to Build a Career in Open Source.pptx
PPTX
Issues in Knowledge representation for students
PPTX
A* algorithm of Artificial Intelligence for BCA students
PPTX
Unit 2.pptx
PPTX
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
PPTX
Clustering.pptx
PPTX
neuralnetwork.pptx
PPTX
Rendering Algorithms.pptx
Shell Programming Language in Operating System .pptx
Types of NoSql Database available.pptx
Introduction to NoSQL & Features of NoSQL.pptx
Clustering, Types of clustering, Types of data
Association rule introduction, Market basket Analysis
Introduction to Internet, Domain Name System
Cascading style sheet, CSS Box model, Table in CSS
Numpy in python, Array operations using numpy and so on
Functions in python, types of functions in python
Extensible markup language ppt as part of Internet Technology
Java script ppt from students in internet technology
Building Competency and Career in the Open Source World
How to Build a Career in Open Source.pptx
Issues in Knowledge representation for students
A* algorithm of Artificial Intelligence for BCA students
Unit 2.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
Clustering.pptx
neuralnetwork.pptx
Rendering Algorithms.pptx
Ad

Recently uploaded (20)

PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Insiders guide to clinical Medicine.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Sports Quiz easy sports quiz sports quiz
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Classroom Observation Tools for Teachers
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Computing-Curriculum for Schools in Ghana
O5-L3 Freight Transport Ops (International) V1.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
human mycosis Human fungal infections are called human mycosis..pptx
Supply Chain Operations Speaking Notes -ICLT Program
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Insiders guide to clinical Medicine.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Module 4: Burden of Disease Tutorial Slides S2 2025
Microbial disease of the cardiovascular and lymphatic systems
O7-L3 Supply Chain Operations - ICLT Program
Sports Quiz easy sports quiz sports quiz
VCE English Exam - Section C Student Revision Booklet
Classroom Observation Tools for Teachers
01-Introduction-to-Information-Management.pdf
Cell Structure & Organelles in detailed.
STATICS OF THE RIGID BODIES Hibbelers.pdf
GDM (1) (1).pptx small presentation for students
Computing-Curriculum for Schools in Ghana

Shells commands, file structure, directory structure.pptx

  • 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.
  • 7.  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.
  • 9.  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. Boot Block
  • 10.  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.
  • 11.  The superblock is essentially file system metadata and defines the total inodes and blocks, block size, location of the inode table and datablock, 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. Super block
  • 12.  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  File System State
  • 13.  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.  It stores Metadata about individual files and directories, File size, owner, permissions, timestamps, file type Inode table
  • 14.  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.
  • 15.  A data block is the part of the file system where the actual contents of files and directories are stored.  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
  • 16.  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)
  • 17.  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
  • 18.  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.
  • 19.  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 − File Access Modes
  • 20. 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.
  • 21.  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 Directory Access Modes
  • 22. 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).
  • 23. pwd Command  The pwd command is used to display the location of the current working directory. Syntax:  pwd Output: Directory commands
  • 24. mkdir Command  The mkdir command is used to create a new directory under any directory. Syntax:  mkdir <directory name> Output:
  • 25. rmdir Command  The rmdir command is used to delete a directory.  Syntax: rmdir <directory name>  Output:
  • 26. ls Command  The ls command is used to display a list of content of a directory.  Syntax: ls  Output:
  • 27. cd Command  The cd command is used to change the current directory. Syntax:  cd <directory name> Output:
  • 28. Sr.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 File commands
  • 29. 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
  • 30. 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
  • 31.  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. Pipe and pipeline
  • 32. Syntax  Command 1 | command 2 | command 3 | ……
  • 33.  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
  • 34.  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
  • 35.  Now we will use the command to remove all the words that are duplicated in the file. $ Cat file2.txt | sort | uniq
  • 36.  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.
  • 37.  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
  • 38.  Process control commands are the system calls for creating, managing, and coordinating processes. Process control
  • 39. Process control commands in Unix are:  bg - put suspended process into background  fg - bring process into foreground  jobs - list processes
  • 40.  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
  • 41.  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
  • 42.  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
  • 43.  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
  • 44.  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
  • 45. 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.
  • 46. 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.
  • 47.  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

Editor's Notes

  • #4: Multitasking Unix can execute multiple tasks simultaneously. For example, you can print a document while editing another file. Command Structure Unix provides a powerful command-line interface (CLI) that allows users to interact with the system efficiently using commands. File Security and Protection Unix has strong file permission settings (read, write, execute) that control access for the owner, group, and others, ensuring data security. Communication Unix supports user-to-user communication through features like mail, write, wall, and talk. Accounting Unix can track system usage by users or programs, allowing system administrators to monitor performance and resource usage. Unix Tools and Utilities Unix comes with a rich set of small, modular tools that can be combined (piped) to perform complex tasks. Open Source Many Unix variants (like Linux) are open source, meaning the source code is freely available for anyone to use, modify, and distribute. Portable Unix is portable across different hardware platforms, which means the same code can run on various systems with little or no modification. Multiuser Unix supports multiple users working on the same system simultaneously without interfering with each other’s work.
  • #5: 1. Hardware (Innermost Layer) Represents the physical components of the computer like CPU, memory, disk drives, etc. The kernel directly interacts with this layer. 2. Kernel The core part of the Unix OS. Manages system resources like memory, CPU scheduling, and device control. Acts as a bridge between hardware and software. Users cannot interact with the kernel directly. 3. Shell The command interpreter that provides a user interface to access the services of the kernel. Translates user commands into system calls. Several types of shells are shown: sh (Bourne shell) csh (C shell) ksh (Korn shell) bash (Bourne Again SHell) Other utilities included in this layer: cpp, comp, as – for compiling and assembling programs. vi, ed – text editors. cut, env, which, pg, more – command-line tools/utilities. 4. Application Programs (Outermost Layer) These are user-level programs that run on top of the Unix system, such as: Mail – for electronic communication. DBMS – database management systems. FTP – file transfer protocol programs. General application software like text processors, compilers, etc. Types of Shells These are different types of command interpreters that users can choose to interact with the system. Each has its own syntax and features. sh – Bourne Shell The original Unix shell, developed by Stephen Bourne. Simple scripting, widely used for shell scripts. csh – C Shell Syntax similar to the C programming language. Supports job control and aliases. ksh – Korn Shell Combines features of sh and csh. More powerful scripting features. bash – Bourne Again Shell Most common shell in Linux. Enhanced version of sh with command history, auto-completion, etc. 🔹 Compiler & Assembler Commands These are tools used for compiling and assembling source code. cpp – C Preprocessor Handles macro substitution, file inclusion, and conditional compilation before actual compilation starts. comp – Compiler General term; could represent a compiler like gcc, g++, or another specific compiler command depending on the Unix system. as – Assembler Translates assembly language into machine code. 🔹 Text Editors and File Manipulation Tools These are utilities that help in editing and manipulating text. vi – A classic full-screen text editor available on almost all Unix systems. Modal (insert, command, visual) and very efficient for experienced users. ed – Line-oriented text editor; one of the oldest Unix editors. Works in command mode only. cut – Extracts sections from lines of files (e.g., columns or specific characters). Example: cut -d',' -f1 data.csv 🔹 System Info and Viewing Tools env – Displays the environment variables. Can also run a program in a modified environment. which – Locates the executable path of a command. Example: which python → /usr/bin/python pg – Displays the content of a file one screen at a time (paging). Similar to more and less. more – Simple pager for viewing text files one screen at a time. ✅ Summary Table CommandType/Functionsh, csh, ksh, bashDifferent types of Unix shellscppC preprocessorcompCompiler (e.g., gcc)asAssemblervi, edText editorscutFile/text field extractorenvEnvironment variable viewerwhichLocate command pathpg, moreFile viewers/pagers
  • #11: Think of the superblock as the "index page" of a book — it helps the system understand how to navigate and manage all the data in the file system. 💡 Why is it important? Without the superblock, the OS wouldn’t know how to access files or manage disk space. If the superblock gets corrupted, the file system can become unreadable (though backups of the superblock are usually maintained).
  • #12: 1. Blocks in the file system Definition: The total number of blocks that exist in the entire file system. Details: A block is the smallest unit of data storage in a file system. Files are stored in one or more blocks. Example: If each block is 4KB and the file system has 100,000 blocks, then the total size of the file system is 400 MB. 2. Number of free blocks in the file system Definition: The count of unused or unallocated blocks in the file system. Details: These are blocks not currently used by any file or directory. They represent the amount of available space. Use: Monitoring this helps detect when a disk is getting full. 3. Inodes per block group Definition: Number of inodes allocated within each block group. Details: An inode stores metadata about a file (permissions, owner, timestamps, and pointers to blocks). The file system is divided into block groups for efficiency. Example: If a block group has 8192 inodes, it can support 8192 files in that group. 4. Blocks per block group Definition: Number of blocks allocated to each block group. Details: Helps in organizing storage to reduce fragmentation and speed up file access. Why it matters: Optimizes local access; files in the same directory are likely to be in the same group. 5. Mount time Definition: The last time the file system was mounted. Use: Useful for system administrators to monitor access and usage history. 6. Write time Definition: The last time the file system was written to (i.e., when any data was last modified). Use: Important for tracking changes and backups. 7. File System State Definition: Indicates whether the file system was cleanly unmounted or has errors. Values: clean: The file system was properly unmounted. errors: There were issues during the last session (e.g., power loss or crash). Use: The OS checks this during boot to decide whether a file system check (fsck) is needed.
  • #15: Superblock: Blueprint of the whole building. Inode Table: List of all rooms and their details. Data Blocks: What’s actually inside the rooms — the real content. If you open a text file that says: Hello, world! The inode tells you: Who owns it When it was modified Where the data blocks are The data block actually stores: "Hello, world!"
  • #16: 1. 📝 Plain Data Blocks (for regular files) These store the actual content of a regular file like: Hello, world! The inode of a file points directly or indirectly to these blocks. Example: If you open notes.txt, the contents like Shopping list are stored in plain data blocks. 2. 🔗 Symbolic-Link Data Blocks Used when a file is a symbolic link (like a shortcut or pointer to another file or directory). The data block contains the path to the target. For example: ln -s /home/user/file.txt mylink Now, mylink is a symbolic link. Its data block stores: 3. 📁 Directory Data Blocks These are used when the file is a directory. The data block stores directory entries in the form of: In Unix-like file systems, everything is treated as a file — including directories.
  • #29: The less command in Unix/Linux is used to view (but not edit) the contents of a file one page at a time. It is especially useful for viewing large files because it doesn't load the entire file into memory.
  • #30: In more command u can only scroll forward not backward
  • #45: System Calls and Their Purpose access() What it does: Checks if the process has permission (read, write, execute) to access a file. Example: Useful before opening or modifying a file. chdir() What it does: Changes the current working directory of the process. Example: Like using cd in the terminal, but used in programs. chmod() What it does: Changes the permission mode of a file (like read/write/execute for users). Example: To allow or deny access to files for users or groups. chown() What it does: Changes the owner or group of a file. Example: When a file is transferred from one user to another. kill() What it does: Sends a signal to a process (not always to "kill" it — it can be any signal). Example: Can stop a process, pause it, or make it reload settings. link() What it does: Creates a new name (hard link) pointing to the same file. Example: If two filenames refer to the same physical file on disk. open() What it does: Opens a file so that it can be read from or written to. Example: A fundamental operation in file handling programs. pause() What it does: Suspends the process until a signal is received. Example: A program may wait for a signal (like Ctrl+C) before doing something.
  • #46: ⏲️ Time and Process System Calls stime() What it does: Sets the system time. Example: Used by admin-level programs to update the system clock. times() What it does: Retrieves time-related statistics (user time, system time) for the calling process and its terminated child processes. Example: Helpful in performance analysis and debugging. alarm() What it does: Sets a timer that sends a SIGALRM signal to the process after a specified number of seconds. Example: Often used to implement timeouts in programs. 👨‍👧‍👦 Process and File Environment System Calls fork() What it does: Creates a new child process that is a copy of the parent. Example: Fundamental for multitasking and creating daemons or services. chroot() What it does: Changes the root directory for the current process. Example: Common in creating "chroot jails" for security and isolation. exit() What it does: Terminates a process and returns a status code to the parent. Example: Ensures a program ends cleanly, possibly passing exit info.