Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 64

Department of InformationTechnology

DEPARTMENT OF INFORMATION
TECHNOLOGY
Practical File

B.Tech (IT) 2nd Year – 4thSemester

Subject: Operating Systems Lab


BTIT 405-18

CHANDIGARH ENGINEERING COLLEGE


(LANDRAN)

Submitted To :- Submitted by:-

Mr. Neeraj Sharma Hritik Sharma 1902629

1902629 Page 1
Department of InformationTechnology
Sr no. Task Page no.
1 Introduction to Operating system and case study 3 to 11
on DOS,LINUX and WINDOWS operating
system.

2 Installation of LINUX operating system. 12 to 18

3 Implementation of FCFS scheduling algorithms to find 19 to 21


turnaround time and waiting Time.

4 Implementation of SJF scheduling algorithms to find 22 to 25


turnaround time and waiting Time.

5 Implementation of Round Robin scheduling algorithms to 26 to 29


find turnaround time and waiting Time.

6 Implementation of Priority scheduling algorithms to 30 to 34


find turnaround time and waiting Time.

7 Virtualization, Installation of Virtual Machine Software, 35 to 38


and installation of Operating System on Virtual Machine.

8 LINUX, file system, creating, copying, removing, renaming, 39 to 45


and moving files in LINUX operating system

9 Listing files and directory, changing file permission and 46 to 50


directory related commands.

10 To work on miscellaneous commands in Linux. (Logname, 51 to 54


Who, who am I, date, cal, wc, sort, grep).

11 To study shell programming in linux. 55 to 57

12 To study arithmetic expression , conditional statement ,loops 58 to 60


in shell program.

1902629 Page 2
Department of InformationTechnology

Task NO:- 1
TITLE:- Introduction to Operating system and case study on DOS,LINUX and
WINDOWS operating system.
OBJECTIVE:-
• To study different types of operating system.
• To study DOS, LINUX and WINDOWS operating system.
• To do comparison between DOS, LINUX and WINDOWS operating system.
THEORY:-
1 To study different types of operating system:-
Operating system:- An operating system (OS) is a collection of software that manages
computer hardware resources and provides common services for computer programs. The
operating system is a vital component of the system software in a computer system.

TYPES OF OPERATING SYSTEM:-

• Batch operating system


• Time-sharing operating systems
• Distributed operating System
• Network operating System
• Real Time operating System

Batch operating system:- The users of a batch operating system do not interact with the
computer directly. Each user prepares his job on an off-line device like punch cards and
submits it to the computer operator. To speed up processing, jobs with similar needs

1902629 Page 3
Department of InformationTechnology

are batched together and run as a group. The programmers leave their programs with the
operator and the operator then sorts the programs with similar requirements into batches.
Time-sharing operating systems:- Time-sharing is a technique which enables many
people, located at various terminals, to use a particular computer system at the same time.
Time-sharing or multitasking is a logical extension of multiprogramming. Processor's time
which is shared among multiple users simultaneously is termed as time-sharing.
Distributed operating System:- Distributed systems use multiple central processors to
serve multiple real-time applications and multiple users. Data processing jobs are distributed
among the processors accordingly.
Network operating System:- A Network Operating System runs on a server and
provides the server the capability to manage data, users, groups, security, applications, and
other networking functions. The primary purpose of the network operating system is to allow
shared file and printer access among multiple computers in a network, typically a local area
network (LAN), a private network or to other networks.
Real Time operating System:- A real-time system is defined as a data processing
system in which the time interval required to process and respond to inputs is so small that it
controls the environment. The time taken by the system to respond to an input and display of
required updated information is termed as the response time. So in this method, the response
time is very less as compared to online processing.
2 To study DOS, LINUX and WINDOWS operating system.:-

Disk Operating System (in detail):- A disk operating system (abbreviated DOS) is a
computer operating system that resides on and can use a disk storage device, such as a floppy
disk, hard disk drive, or optical disc. A disk operating system must provide a file system for
organizing, reading, and writing files on the storage disk. Strictly speaking, this definition
does not apply to current generations of operating systems, such as versions of Microsoft
Windows in use, and is more appropriately used only for older generations of operating
systems.

Types of DOS commands


Any instruction given to the computer to perform a specific task is called
command. The DOS has several commands, each for a particular task and these are
stored in DOS directory on the disk. The commands are of two types : (a)Internal

1902629 Page 4
Department of InformationTechnology

Commands : These are in built commands of MS-DOS i.e. these are stored in
Command interpreter file (COMMAND.COM). These commands reside in the
memory as long as the machine is at he system prompt(C:\>) level. To use these
commands no extra /external file is required. E.g. DATE, TIME, DIR, VER etc. (b)
External commands : These are separate program (.com) files that reside in DOS
directory and when executed behave like commands. An external command has
predefined syntax. for e.g. HELP, DOSKEY, BACKUP, RESTORE, FORMAT
etc.
Types of DOS commands
Any instruction given to the computer to perform a specific task is called command. The
DOS has several commands, each for a particular task and these are stored in DOS directory
on the disk. The commands are of two types : (a)Internal Commands : These are in built
commands of MS-DOS i.e. these are stored in Command interpreter file
(COMMAND.COM). These commands reside in the memory as long as the machine is at he
system prompt(C:\>) level. To use these commands no extra /external file is required. E.g.
DATE, TIME, DIR, VER etc. (b) External commands : These are separate program (.com)
files that reside in DOS directory and when executed behave like commands. An external
command has predefined syntax. for e.g. HELP, DOSKEY, BACKUP, RESTORE,
FORMAT etc.

Windows OS (in detail):- WINDOWS was similar to APPLE Mach operating system
interface on IBM-PC. The main features of windows are easy to use graphical user interface
(GUI), device independent graphics and multitasking support. The first version of
windows1.0 was introduced in 1985. Windows was an application of MS-DOS using the
basic commands of DOS. Windows for Workgroup (WIN3.11) released in 1992 was an
integrated windows and networking package with file and printer sharing capabilities, a
network mail (Microsoft Mail) and a workgroup scheduler (Schedule+) packages in windows
environment. WINDOWS-95 released in 1995 is a 32-bit operating system which includes
MS-DOS7.0 and takes control of computer system after starting.

The main features of WINDOWS-95 are:-


• Windows 95 is easier to learn and use than any of its predecessors.

1902629 Page 5
Department of InformationTechnology

• Windows 95 and its applications run under the PCs protected mode, which mean that
one ill behaved program cannot compromise the memory and resources of another.
This approach adds a large measure of reliability to the total operating environment.
The crash of a single errant program does not automatically crash the operating
system or any of other programs that your running.
• Windows 95 is a pre-emptive multitasking means that programs running in the
background do not significantly degrade the interactive program that you are running
in the foreground e.g. you can comfortably type into word processors while your
database system backs up all its files. Under Windows 3.1 the typed key displays
lagged behind while the backup procedure logged the processor.
• Windows 95 integrates virtually all of your computing tasks and resources like
networks, E-mail, multimedia, system administration, printing, faxing, applications
into one common user interface.

1902629 Page 6
Department of InformationTechnology
LINUX (in detail):- Linux is one of popular version of UNIX operating System. It is
open source as its source code is freely available. It is free to use. Linux was designed
considering UNIX compatibility. Its functionality list is quite similar to that of UNIX.

Linux Operating System has primarily three components:-

1902629 Page 7
Department of InformationTechnology

• Kernel :− Kernel is the core part of Linux. It is responsible for


all major activities of this operating system. It consists of
various modules and it interacts directly with the
underlying hardware. Kernel provides the required
abstraction to hide low level hardware details to system or
application programs.
• System Library :− System libraries are special functions or
programs using which application programs or system
utilities accesses Kernel's features. These libraries
implement most of the functionalities of the operating
system and do not requires kernel module's code access
rights.
• System Utility :− System Utility programs are responsible to do
specialized, individual level tasks.

3. To do comparison between DOS, LINUX and WINDOWS operating system:-


BASIS OF DOS OPERATING SYSTEM WINDOWS OPERATING
COMPARISON SYSTEM

Description DOS is an operating system that Windows is a group of graphical


uses a disk storage device such as operating system family which are
floppy disk, hard disk drive or an developed, marketed and sold by
optical disc. Microsoft.

Interface DOS uses a command line or Text Windows has Graphical User
based interface. Interface (GUI) and a Command
Line Interface.

Framework Disk operating system runs on disk Windows operating system runs
storage devices such as hard disk on GUI for providing more
interactive,

1902629 Page 8
Department of InformationTechnology
drive or floppy disk for executing intuitive and user-friendly
commands. interface.

Working As a command line OS, users need Windows provides a graphical


to type the commands manually to interface where users can run an
give instructions to the system. application just by recognizing
icons and images.

Version MS-DOS, FreeDOS, PTS-DOS, Windows 95, XP, Vista, Windows


DR-DOS, 86-DOS, ROM-DOS, 7, 8, 10 etc.
OpenDOS, Novell DOS etc.

Windows LIMUX

Develo Microsoft Corporation Linus Torvalds, community


pe r

Written C++, Assembly Assembly language, C


in

Kernel Windows NT family Monolithic kernel (whole operating system works in


type has a hybrid kernel the kernel space).
(combination of
microkernel and
monolithic kernel);
Windows
CE(Embedded
compact) also have
hybrid kernel;
Windows 9x and
earlier series has a
monolithic kernel
(MS-DOS).

Platforms ARM, IA Alpha,


32, Itanium, x86- H8/300, Hexagon, Itanium, m68k, Microblaze,
64, DEC MIPS, P A-RISC, PowerPC, RISC-

1902629 Page 9
Department of InformationTechnology
Alpha, MIPS, V, s390, SuperH, NDS32, Nios II, OpenRISC,
PowerP C. SPARC, ARC Unicore32, x86, Xtensa, ARM, C6x.

Ease of Windows has a rich It is mostly used by technical people because you
use GUI and can be should know various Linux commands to be able to
easily used by work with Linux OS. For an average user, it will
technical as well as require significant time to learn Linux. Also, the
non-technical troubleshooting process on Linux is complicated than
persons. It is very on Windows.
simple and user
friendly.

Default Windows shell Unix shell


user
interface

DOS OPERATING LIMUX


SYSTEM

DOS is an operating system Linus Torvalds, community


that uses a disk storage
device such as floppy disk,
hard disk drive or an optical
disc.

DOS uses a command line Assembly language, C


or Text based interface

Disk operating system runs It is mostly used by technical people because you should
on disk storage devices know various Linux commands to be able to work with
such as hard disk drive or Linux OS. For an average user, it will require significant
floppy disk for executing time to learn Linux. Also, the troubleshooting process on
commands. Linux is complicated than on Windows.

As a command line OS, Monolithic kernel (whole operating system works in the
users need to type the kernel space).
commands manually to
give instructions to the
system.

MS-DOS, FreeDOS, PTS Alpha,


DOS, DR-DOS, 86-DOS, H8/300, Hexagon, Itanium, m68k, Microblaze, MIPS, PA-

1902629 Page 10
Department of InformationTechnology
ROM-DOS, OpenDOS, RISC, PowerPC, RISC-V, s390, SuperH, NDS32, Nios
Novell DOS etc. II, OpenRISC, SPARC, ARC Unicore32, x86, Xtensa,
ARM, C6x.

1902629 Page 11
Department of InformationTechnology

Task NO:- 2

TITLE:- Installation of LINUX operating system.


Theory:- These days many users want to try Linux but are in dilemma that whatever they
will be able to install Linux themselves or not. Installing Linux is a very easy task but if the
user thinks the user might not be able to install Linux or it is not easy to install Linux just
read the step-by-step guide given below and then decide user that installing Linux is easy or
not the user can download Ubuntu from here after downloading Ubuntu user need to create an
ID and live USB Drive.

Procedure:-

STEP 1:- Insert the ID in the drive and boot the computer from CD. First of all, the user will
be prompted to select the language to select English or any other language according to users
performance.
STEP 2:- Now the user will be open to Menu user can choose try Ubuntu without installing
option to try Ubuntu without actually installing it on the user hardware drive for installing
you want to choose the second option download Ubuntu.

1902629 Page 12
Department of InformationTechnology
STEP 3:- Open to start now initialize and after few minutes user can use the installation
window step four clip forward and it will check the minimum requirement for running
Ubuntu on uses PC if everything is fine music and sea green colored tick marks user can also
select the download update while installing and install some third-party software after
selecting the things user want to click forward.
1902629 Page 13
Department of InformationTechnology
STEP 4:- Now user can choose either erase and use entire disk option or specify party mint
manually option user can choose the first option. User can choose the first option if you just
bought Linux to exist in users system as select second option now it will display the free
space available for users PC.
Free space and click on add option to create a new partition and choose partition type as
primary size around 70% of the free space available or choose anything like 1000 or 2000
MB used as extra general file system and selecting point.

1902629 Page 14
Department of InformationTechnology
Now again select free space from the table and click add option now select size to be around
300 MB use it as extracting journaling file system and select mount point as boot.
Now games next 20 days from the table and click adoption now select size to be around twice
the size of users Ram that is around 1000 MB if users RAM size is 512 MB and select used
as a swap area and take on.

1902629 Page 15
Department of InformationTechnology
STEP 5:- Click install new button and then visit will ask users location select users location
and click forward.

1902629 Page 16
Department of InformationTechnology
STEP 6:- while user are selected these optimize wizard will continue to copy files now select
users deserved keyboard and click forward.
STEP 7:- Now fill the details about the user, name, computer name, the username and create
a password and click forward and let Ubuntu copy all the essential files.

1902629 Page 17
Department of InformationTechnology

STEP 8:- After all files have been explained and installed 12 will display a message saying
that installation complete and click on restart button to restart your computer remove the CD
from the CD Drive.
Step 9:- After restarting user PC wait for the ubuntu to load and then it will display the login
screen. Choose the user and enter password and click login.

1902629 Page 18
Department of InformationTechnology

Task NO:- 3

TITLE:- Implementation of FCFS scheduling algorithms to find turnaround time and


waiting Time.
Theory:-

FCFS scheduling :-First Come First Serve (FCFS) is an operating system scheduling
algorithm that automatically executes queued requests and processes in order of their arrival.
It is the easiest and simplest CPU scheduling algorithm. In this type of algorithm, processes
which requests the CPU first get the CPU allocation first. This is managed with a FIFO
queue. The full form of FCFS is First Come First Serve.

Code:-

#include<stdio.h>

#include<conio.h>

void main()

char pn[10][10];

int arr[10],bur[10],star[10],finish[10],tat[10],wt[10],i,n;

int totwt=0,tottat=0;

printf("Enter the number of processes:");

scanf("%d",&n);

for(i=0;i<n;i++)

printf("Enter the Process Name, Arrival Time & Burst Time:");

scanf("%s%d%d",&pn[i],&arr[i],&bur[i]);

1902629 Page 19
Department of InformationTechnology

for(i=0;i<n;i++)

if(i==0)

star[i]=arr[i];

wt[i]=star[i]-arr[i];

finish[i]=star[i]+bur[i];

tat[i]=finish[i]-arr[i];

else

star[i]=finish[i-1];

wt[i]=star[i]-arr[i];

finish[i]=star[i]+bur[i];

tat[i]=finish[i]-arr[i];

printf("\nPName Arrtime Burtime Start TAT Finish");

for(i=0;i<n;i++)

printf("\n%s\t%6d\t\t%6d\t%6d\t%6d\t%6d",pn[i],arr[i],bur[i],star[i],tat[i],finish[i]);

totwt+=wt[i];

tottat+=tat[i];

1902629 Page 20
Department of InformationTechnology

printf("\nAverage Waiting time:%f",(float)totwt/n);

printf("\nAverage Turn Around Time:%f",(float)tottat/n);

getch();

Output:-

19026
29 Page 21

Department of InformationTechnology

Task NO:- 4

TITLE:- Implementation of SJF scheduling algorithms to find turnaround time and waiting
Time.
Theory:-

SJF scheduling:- It is an algorithm in which the process having the smallest execution
time is chosen for the next execution. This scheduling method can be preemptive or non
preemptive. It significantly reduces the average waiting time for other processes awaiting
execution. The full form of SJF is Shortest Job First.

Types Of SJF Scheduling:-

1 Preemptive:- In Preemptive SJF Scheduling, jobs are put into the ready queue as they
come. A process with shortest burst time begins execution. If a process with even a shorter
burst time arrives, the current process is removed or preempted from execution, and the
shorter job is allocated CPU cycle.

2 Non-Preemptive:- In non-preemptive scheduling, once the CPU cycle is allocated to


process, the process holds it till it reaches a waiting state or terminated.

Code:-

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

int et[20],at[10],n,i,j,temp,st[10],ft[10],wt[10],ta[10];

int totwt=0,totta=0;

float awt,ata;

1902629 Page 22
Department of InformationTechnology

char pn[10][10],t[10];

printf("Enter the number of process:");

scanf("%d",&n);

for(i=0;i<n;i++)

printf("Enter process name, arrival time & execution time:");


scanf("%s%d%d",pn[i],&at[i],&et[i]);

for(i=0;i<n;i++)

for(j=0;j<n;j++)

if(et[i]<et[j])

temp=at[i];

at[i]=at[j];

at[j]=temp;

temp=et[i];

et[i]=et[j];

et[j]=temp;

strcpy(t,pn[i]);

strcpy(pn[i],pn[j]);

strcpy(pn[j],t);

}}

1902629 Page 23
Department of InformationTechnology

for(i=0;i<n;i++)

if(i==0) st[i]=at[i];

else st[i]=ft[i-1];

wt[i]=st[i]-at[i];

ft[i]=st[i]+et[i];
ta[i]=ft[i]-at[i];

totwt+=wt[i];

totta+=ta[i];

awt=(float)totwt/n;

ata=(float)totta/n;

printf("\nPname\tarrivaltime\texecutiontime\twaitingtime\ttatime");

for(i=0;i<n;i++)

printf("\n%s\t%5d\t\t%5d\t\t%5d\t\t%5d",pn[i],at[i],et[i],wt[i],ta[i]);

printf("\nAverage waiting time is:%f",awt);

printf("\nAverage turnaroundtime is:%f",ata);

getch();

1902629 Page 24
Department of InformationTechnology

Output:-
19026

29 Page 25

Department of InformationTechnology

Task NO:- 5

TITLE:- Implementation of Round Robin scheduling algorithms to find turnaround time


and waiting Time.
Theory:-

Round Robin Scheduling:-

• Round Robin is the preemptive process scheduling algorithm.

• Each process is provided a fix time to execute, it is called a quantum.

• Once a process is executed for a given time period, it is preempted and other process
executes for a given time period.

• Context switching is used to save states of preempted processes.

Code:-

#include<stdio.h>

#include<conio.h>

void main()
{

int i, NOP, sum=0,count=0, y, quant, wt=0, tat=0, at[10], bt[10], temp[10];

float avg_wt, avg_tat;

printf(" Total number of process in the system: ");

scanf("%d", &NOP);

y = NOP;

for(i=0; i<NOP; i++)

1902629 Page 26
Department of InformationTechnology

printf("\n Enter the Arrival and Burst time of the Process[%d]\n", i+1);

printf(" Arrival time is: \t");

scanf("%d", &at[i]);

printf(" \nBurst time is: \t");

scanf("%d", &bt[i]);

temp[i] = bt[i];

printf("Enter the Time Quantum for the process: \t");

scanf("%d", &quant);

printf("\n Process No \t\t Burst Time \t\t TAT \t\t Waiting Time ");

for(sum=0, i = 0; y!=0; )

if(temp[i] <= quant && temp[i] > 0)

{
sum = sum + temp[i];

temp[i] = 0;

count=1;

else if(temp[i] > 0)

temp[i] = temp[i] - quant;

sum = sum + quant;

1902629 Page 27
Department of InformationTechnology

if(temp[i]==0 && count==1)

y--;

printf("\nProcess No[%d] \t\t %d\t\t\t\t %d\t\t\t %d", i+1, bt[i], sum-at[i], sum-at[i]- bt[i]);

wt = wt+sum-at[i]-bt[i];

tat = tat+sum-at[i];

count =0;

if(i==NOP-1)

i=0;

else if(at[i+1]<=sum)

{
i++;

else

i=0;

avg_wt = wt * 1.0/NOP;

1902629 Page 28
Department of InformationTechnology
avg_tat = tat * 1.0/NOP;

printf("\n Average Turn Around Time: \t%f", avg_wt);

printf("\n Average Waiting Time: \t%f", avg_tat);

getch();

Output:-

19026

29 Page 29
Department of InformationTechnology

Task NO:- 6

TITLE:- Implementation of Priority scheduling algorithms to find turnaround time and


waiting Time.

Theory:-

Priority scheduling :-

• Priority scheduling is a non-preemptive algorithm and one of the most common


scheduling algorithms in batch systems.

• Each process is assigned a priority. Process with highest priority is to be executed first
and so on.

• Processes with same priority are executed on first come first served basis.

• Priority can be decided based on memory requirements, time requirements or any other
resource requirement.

Code:-

#include<stdio.h>

#include<conio.h>

#include<string.h>

int main()

int et[20],at[10],n,i,j,temp,p[10],st[10],ft[10],wt[10],ta[10];

int totwt=0,totta=0;

float awt,ata;

1902629 Page 30
Department of InformationTechnology

char pn[10][10],t[10];

printf("Enter the number of process:");

scanf("%d",&n);

for(i=0;i<n;i++)

printf("Enter process name,arrivaltime,execution time & priority:");

scanf("%s%d%d%d",pn[i],&at[i],&et[i],&p[i]);

for(i=0;i<n;i++)

for(j=0;j<n;j++)

if(p[i]<p[j])

temp=p[i];

p[i]=p[j];

p[j]=temp;

temp=at[i];

at[i]=at[j];

at[j]=temp;

temp=et[i];

1902629 Page 31
Department of InformationTechnology

et[i]=et[j];

et[j]=temp;

strcpy(t,pn[i]);

strcpy(pn[i],pn[j])

; strcpy(pn[j],t); }

for(i=0;i<n;i++)

if(i==0)

st[i]=at[i];

wt[i]=st[i]-at[i];

ft[i]=st[i]+et[i];

ta[i]=ft[i]-

at[i]; }

else

st[i]=ft[i-1];

wt[i]=st[i]-at[i];

1902629 Page 32
Department of InformationTechnology
ft[i]=st[i]+et[i];

ta[i]=ft[i]-at[i];

totwt+=wt[i];

totta+=ta[i];

awt=(float)totwt/n;

ata=(float)totta/n;

printf("\nPname\tarrivaltime\texecutiontime\tpriority\twaitingtime\ttatime");

for(i=0;i<n;i++)

printf("\n%s\t%5d\t\t%5d\t\t%5d\t\t%5d\t\t%5d",pn[i],at[i],et[i],p[i],wt[i],ta[i]);

printf("\nAverage waiting time is:%f",awt);

printf("\nAverage turnaroundtime is:%f",ata);

getch();

1902629 Page 33
Department of InformationTechnology
Outpit:-

19026

29 Page 34

Department of InformationTechnology

Task NO:- 7

TITLE:- Virtualization, Installation of Virtual Machine Software, and installation of


Operating System on Virtual Machine.
Theory:-

Virtual box:
Oracle VM VirtualBox is a free and open-source hosted hypervisor for x86 virtualizations
developed by Oracle Corporation it was acquired by sun microsystems in 2008, which was
intern acquired by Oracle in 2010 VirtualBox may be installed on Windows and Mac OS.

Steps for the installation of the Linux operating system in a virtual

box. STEP 1:- Install VirtualBox on your computer system.

1902629 Page 35
Department of InformationTechnology

STEP 2:-open virtualbox.


STE
P 3:-click on new.
STEP 4:-enter the name of your Virtualbox.

STE
P 5:-click on next.
STEP 6:- select an amount of RAM for use.

1902629 Page 36
Department of InformationTechnology
STEP 7:-click on next.
STEP 8:-create your virtual machines.
STEP 9:- make
sure that your Ubuntu file is downloading.

1902629 Page 37
Department of InformationTechnology
STEP 10:-double click on the virtual machine name.
STEP 11:-click on the folder shaped icon.
STEP 12:- select your Ubuntu ISO.

STEP
13 :- click on install Ubuntu.
1902629
Page 38
Department of InformationTechnology

Task NO. :- 8

Title:- LINUX, file system, creating, copying, removing, renaming, and moving files in
LINUX operating system.

Objective:-

• To study Linux file system.


• To study commands for creating files : TOUCH and CAT
• To study commands for copying file in Linux : CP
• To study command for removing ,renaming and moving file : RM ,MV •
To study Linux file system.

Theory:-

FILE SYSTEM:- It is used to control how data is stored and retrieved. Without a file
system, information placed in a storage area would be one large body of data with no way to
tell where one piece of information stops and the next begins.
There are many different kinds of file systems. Each one has different structure and logic,
properties of speed, flexibility, security, size and more. Some file systems have been designed
to be used for specific applications. For example, the ISO 9660 file system is designed
specifically for optical discs.

File systems can be used on many different kinds of storage devices. Each storage device
uses a different kind of media. The most common storage device in use today is a hard drive
whose media is a disc that has been coated with a magnetic film. In some cases, the
computer's main memory (RAM) is used to create a temporary file system for short term use

TYPES OF FILE SYSTEM :-

File system types can be classified into disk/tape file systems, network file systems and
special-purpose file systems.

1. Disk file systems:-A disk file system takes advantages of the ability of disk storage
media to randomly address data in a short amount of time. This permits multiple users access

1902629 Page 39
Department of InformationTechnology

to various data on the disk without regard to the sequential location of the data. Examples
include FAT, exFAT, NTFS, HFS and

2. Flash file systems:- A flash file system considers the special abilities, performance
and restrictions of flash memory devices. Frequently a disk file system can use a flash
memory device as the underlying storage media but it is much better to use a file system
specifically designed for a flash device.

3. Tape file systems:- A tape file system is a file system and tape format designed to
store files on tape in a self-describing form. Magnetic tapes are sequential storage media with
significantly longer random data access times than disks, posing challenges to the creation
and efficient management of a general-purpose file system.

4. Database file systems:- Another concept for file management is the idea of a
database-based file system. Instead of, or in addition to, hierarchical structured management,
files are identified by their characteristics, like type of file, topic, author, or similar. Very
large file systems, embodied by applications like Apache Hoodoo and Google File System,
use some database file system concepts.
5. Transactional file systems:-Transaction processing introduces the isolation
guarantee, which states that operations within a transaction are hidden from other threads on
the system until the transaction commits, and that interfering operations on the system will be
properly serialized with the transaction.. This means that if there is a crash or power failure,
after recovery, the stored state will be consistent.

6. Network file systems:- A network file system is a file system that acts as a client for a
remote file access protocol, providing access to files on a server. Examples of network file
systems include clients for the NFS, AFS, SMB protocols, and file-system-like clients for
FTP and WebDAV.

7. Shared disk file systems:- A shared disk file system is one in which a number of
machines (usually servers) all have access to the same external disk subsystem (usually a
SAN). The file system arbitrates access to that subsystem, preventing write collisions.

1902629 Page 40
Department of InformationTechnology

Examples include GFS2 from Red Hat, GPFS from IBM, SFS from Dataflow, CXFS from
SGI and StorNext from Quantum Corporation.

EXAMPLES FOR DIFFERENT FILE SYSTEM:-

(1)FAT:- File Allocation Table FAT is supported by almost all operating systems for
personal computers, including all versions of Windows and MS-DOS/PC DOS and DR
DOS. SCP86-DOSDigital Research Concurrent DOSCP/M-86The FAT file systems are
therefore well-suited as a universal exchange format between computers and devices of
most any type and age. Over the years, the file system has been expanded from FAT12 to
FAT16 and FAT32. Various features have been added to the file system including
subdirectories, codepage support, extended attributes, and long filenames.

The FAT12 and FAT16 file systems had a limit on the number of entries in the root directory
of the file system and had restrictions on the maximum size of FAT-formatted disks or
partitions.FAT32 addresses the limitations in FAT12 and FAT16, except for the file size limit
of close to 4 GB, but it remains limited compared to NTFS.

(2) NTFS:- NTFS, introduced with the Windows NT operating system in 1993, allowed
ACL-based permission control. Other features also supported by NTFS include hard
links, multiple file streams, attribute indexing, quota tracking, sparse files, encryption,
compression, and reparse points (directories working as mount-points for other file
systems, symlinks, junctions, remote storage links
(3) exFAT:- exFAT is a proprietary and patent-protected file system with certain
advantages over NTFS with regard to file system overhead.exFAT is not backward
compatible with FAT file systems such as FAT12, FAT16 or FAT32. The file system is
supported with newer Windows systems, such as Windows Server 2003, Windows Vista,
Windows 2008, Windows 7, Windows 8, and more recently, support has been added for
Windows XP.[20]exFAT is supported in Mac OS X starting with version.

• To study commands for creating files : TOUCH and CAT


(1)Touch :-The touch command allows users to make files using the Linux CLI.
Just as the mkdir command makes directories, the touch command makes files. Just as
you would make a .doc or a .txt using a PC desktop, the touch command makes empty
files.

1902629 Page 41
Department of InformationTechnology

Syntax: - touch file name


Touch file 1 file 2 …….n
An example of the touch command: touch testfile.txt
The example touch command effectively created the file testfile.txt. As noted by the
extension, the file created is a .txt or text file. To equate, a .txt file in Linux is akin to
a .txt notebook file within a Windows or Mac OS.
Example:- touch a1 a2 a3 .
It means we can also create multiple files using this command.A here we created 3
different files a1,a2 and a3.

(2)CAT:-This command is used to display the contents of a file. You can read the
content of a file using cat command. Because by using command touch can can’t be
able to write on a file you can only able to create a new empty file .That’s why by
using cat command we can write on our new file.
Syntax for this command:- cat > file name
Example:- $ cat > a4
This mean we are writing something in file a4 then we save the content by using ctrl
d.
If we want to see the content of file a4 then we write command $cat a4 .
We can also copy multiple files .
Example:- cat a4 a5 > b1
This mean we are copying contents of both file a4 and a5 into file b1.
• To study commands for copying file in Linux : CP

(1)Cp command:-This command is used to copy file and directory. Whenever we


want to copy content of one file to another then we use this command. The cp
command makes a copy of a file for you.

For example:- cp file footmarks an exact copy of the file whose name you entered
and name the copy too, but the first file will still exist with its original name. After
you use mv, the original file no longer exists, but after you use cp, that file stays and a
new copy is made.

1902629 Page 42
Department of InformationTechnology

cp [option(s)] sourcefile targetfile:- Copies sourcefile to targetfile.

Syntax of command is:-

Cp file 1 file 2

Cp file 1 file 2 file 3

Example:- cp a4 a5
This command means we are copying content of file a4 to file a5.
• To study command for Removing ,Renaming and Moving file : RM
,MV
(1) MOVING COMMAND :- MV
The MV command - move - allows a user to move a file to another folder or directory.
MV command can be used to move any number of files and folders in a single
command.
The syntax is as follows:-

mv source target mv folder1 folder2 target mv folder1 file1 target mv -option source
target
An example of the mv command is:-
mv [option(s)] source file target file
Copies source file to target file then deletes the original source file..

(2) RENAMING COMMAND :-In order to rename a file in Linux you can use
either of two approaches

(A)Create a copy of the existing file with the new desired name and then delete the old
Rename with copy and delete.

1902629 Page 43
Department of InformationTechnology

EXAMPLE:- $ cp oldfile newfile.

This creates a copy of the same file with a new name in the same location.

$ rm oldfile

This will delete the old file keeping the newfile intact file.

(B) Rename the file by moving it with the mv command.

EXAMPLE:-

Rename by moving

$mv old-file-name new-file-name

This just moves the old file, to a new name. rm [option(s)] file(s)

Removes the specified files from the file system. Directories are not removed by rm
unless the option -r is used.

-r Deletes any existing subdirectories . -I Waits for confirmation before deleting each
file

(C) Renaming a directory:-

Renaming a directory in Linux and Unix is similar to renaming a file. All we need to do is
replace the file name with the directory name that is to be renamed.

For example, if we wanted to rename the directory “RR1″ to “ST1″, then we can use the
following command.

$ mv RR1 ST1

(3)REMOVING COMMAND: RM
The rm command - remove - like the rmdir command is meant to remove files
from your Linux OS. Whereas the rmdir command will remove directories and

1902629 Page 44
Department of InformationTechnology

files held within, the rm command will delete created files. An example of the rm
command:

rm testfile.txt
The aforementioned command removed testfile.txt. Interestingly, whereas the
rmdir command will only delete an empty directory, the rm command will remove
both files and directories with files in it. This said, the rm command carries more
weight than the rmdir command and should be used with more specificity.

Remove a directory :-rmdir


The rmdir - remove directory - command allows the user to remove an existing
command using the Linux CLI. An example of the rmdir command: rmdir
testdirectory
The example command removed the directory "testdirectory".
It should be noted: both the mkdir and rmdir commands make and remove
directories. They do not make files and they will also not remove a directory
which has files in it. The mkdir will make an empty directory and the rmdir
command will remove an empty directory.
1902629 Page 45
Department of InformationTechnology

Task No. :- 9
TITLE:- Listing files and directory, changing file permission and directory related
commands.

OBJECTIVE:-

• To study the commands for listing files and directory: ls , ls-a , ls-l , ls using wild cards.
• To study commands for changing permission of files:chmod
• To study commands for changing directory,creating directory,removing directory and to
see present working directory: mkdir , rmdir ,cd , pwd .

THEORY:-

• To study the commands for listing files and directory: ls , ls-a , ls-l , ls
using wild cards.
Basically ls means listing files .so files can be hidden , it can be long listing ,or it can
be existing files so that’s why ls command can be used in many ways i.e.

1. Ls
2. Ls – a
3. Ls – l
4. Ls - a – l
5. Ls using wild cards

1. LS COMMAND: - This command is used for showing exixting all files and
directory ,when ever we want to see saved files and directory we always use ls
command for it .it shows file with different colors like blue color shows
directories and while colour shows files .
2. LS – A COMMAND:- This command is used to listing out all hidden files.
That’s why for viewing hidden files we use ls- a command.sometime we hide
our file for preveting its viewing that’s why to see hidden files we use this
command.

1902629 Page 46
Department of InformationTechnology
Example for ls and ls – a command :-

3. LS- L COMMAND :- This command is used for viewing long listing files , it means it
shows a long list of many no of files .
Example :-

Example for ls – a

and ls – l command:-

1902629 Page 47
Department of InformationTechnology

4. LS – A - L COMMAND :- This command is used to show both hidden


files and long listing files.

Example-
:- 5.

LS COMMAND USING WILD CARDS :- ls command can be used


with wild cards in following ways
• Ls a*:- this command list out all files which are saved by name starting with a letter .
we can also use another alphabet using same command inspite of writing any alphabet
at place of a.
• Ls a ? : - This command is used to list out those files whose first letter are saved with
alphabet a and that file consist of only two alphabets ..
• Ls a??:- this another command of ls using wild cards that shows file whose first letter
is starting with a and file contains three alphabets .
Example:-

• To study commands for changing permission of files:chmod

1902629 Page 48
Department of InformationTechnology

Permissions are of three types:-


1. Owner of file:- this tells about the owner of given file.
2. Group:- its that group to which owner belons to .
3. Other:- this includes those files which donot belongs to owner file and group .
Permission includes :-
• Read a file
• Write a file
• Execute a file .

• To study commands for changing directory,creating


directory,removing directory and to see present working directory:
mkdir , rmdir ,cd , pwd .

1. MKDIR COMMAND: - This command is used to make directory .mk stand


for make and dir stand for directory.
Example:-

2.RMDIR COMMAND:- This command is used to remove directory. whenever we


have no of saved directory are existing and when we want to remove one of them then we us
this command along with rmdir we write the name of directory to whom we want to remove .

Example:-

1902629 Page 49
Department of InformationTechnology
1902629 Page 50
Department of InformationTechnology

Task No.:- 10

Title:- To work on miscellaneous commands in Linux. (Logname, Who, who am I, date,


cal, wc, sort, grep).

OBJECTIVE:- To study commands :logname ,who ,who am I ,date , time , cal , wc ,


sort , grep .

(1) LOGNAME COMMAND:- This command tells the user name on which we are
working .
(2) WHO COMMAND:- This display all user name that are working on our
computer.

1902629 Page 51
Department of InformationTechnology

(3) WHO

AM I COMMAND :- This command used to display name of current user.


(4) DATE COMMAND:- this commands tell current user details only .

1902629 Page 52

Department of InformationTechnology

(5) CAL COMMAND:- This command will display date only .

(6)
WC COMMANMD:- WC means word count . Thisa command counts the no of
lines and no of characters .
(7)

SORT COMMAND:- This is very important command .this command is used to sort
inside file details accordingly.

1902629 Page 53
Department of InformationTechnology

(8) GREP

COMMAND:- This command is also very important command .GREP means globally
search a regular expression and print it .By using this command we can search single
letter in file and also can search through line content in a file .
1902629 Page 54
Department of InformationTechnology

Task No. :- 11

Title:- To study shell programming in linux.

OBJECTIVES:-

➢ To use ECHO command


➢ To use read command
➢ To solve arithmetic expression

SHELL:-Shell provide a environment where users can runs its commands ,programs ,and
shell script.

SHELL SCRIPT:-shell script is a computer program designed to be run by the Unix


shell, a command line interpreter.[1] The various dialects of shell scripts are considered to be
scripting languages.

Typical operations performed by shell scripts include file manipulation, program execution,
and printing text.

Advantages and disadvantages:-

• Perhaps the biggest advantage of writing a shell script is that the commands and syntax
are exactly the same as those directly entered at the command line. • On the other hand,
shell scripting is prone to costly errors.
• Another significant disadvantage is the slow execution speed and the need to launch a
new process for almost every shell command executed.

➢ To use ECHO command

ECHO:- this command is used when we want to display the content as it is


written .this comman dwill display sentence or word as is.

SYNTAX:- echo “ …………”

1902629 Page 55
Department of InformationTechnology

EXAMPLE:-

➢ To use read command

READ COMMAND:- this command is used when user want to enter different
values to the different types . so by using this command we can insert values to data.

SYNTAX:- read data1 data2 data3


EXAMPLE:-

➢ To solve arithmetic expression

ARITHMATIC COMMADS:- these are command for solving arithmetic


expressions like addition (+) ,subtraction(-),multiplication(\*) etc.for solving
arithmetic expresiion we need command like EXPR .

SYNTAX:- val=expr $value1 + $value2


$echo “…….”
EXAMPLE:-

1902629 Page 56
Department of InformationTechnology
1902629 Page 57
Department of InformationTechnology

Task No. :-12


Title:- To study arithmetic expression , conditional statement ,loops in shell

program. OBJECTIVE:-

• To perform arithmetic operation using expr.


• To execute conditional statement
✓ If………..then……….fi
✓ If………..then….. ..else……..fi
• To execute loops in shell using relational operator
✓ While …….do…….done

• To perform arithmetic operation using expr.

ARITHMATIC OPERATION:- Arithmatic operations are like + ,- ,/ ,* ,% etc


.we can also perform arithmetic operation in linux using shell programming. For
solving these operation we need command named EXPR .
EXAMPLE:-

• To execute conditional statement

1902629 Page 58
Department of InformationTechnology
CONDITIONAL STATEMENT:- conditional statements are those whose
outcome depends upon some condition i.e. either they are true or false .basdicaly these
statements are if , else , else if etc.nested of these statements are true.

✓ EXAMPLE:- If………..then……….fi

✓ If………..then….. ..else……..fi

• To execute loops in shell using relational operator

While …….do…….done:- While do then can also be implemented using relational


operator .relational operators are like

❖ Equal to--- ( -eq)

1902629 Page 59
Department of InformationTechnology
❖ Not equal to---(-ne)
❖ Greater then---(gt)
❖ Greater then equal to---(-ge)
❖ Less then equal to---(-le)

EXAMPLE:-
1902629 Page 60

You might also like