Professional Documents
Culture Documents
NGSYSTEM
Gov
ernmentPol
ytechni
c,Amr
avat
i.
(
AnAut
onomousI
nst
it
uteofGov
t.ofMahar
asht
ra)
Depar
tmentofI
nfor
mat
ionTechnol
ogy
.
Certi
fi
cate
NameofDepart
ment:Inf
or mationtechnol
ogyDepartmentThi
sistocer
tif
ythat
Name:
SaiA.Sonkhaskar.Identi
tycode18IF055hascomplet
edthepracti
cal
workofthecour seFC5462Oper ati
ngSyst
em
duri
ngtheacademi c
year2020-2021
Signat
ureoft
eacherwho Pr
of.Dr
.P.P.Karde
Dat
e- taughtt
heexaminee HeadOfDepart
ment
04/
02/
2021
FC5462OPERATI
NGSYSTEM
Vi
sion
Toensureexcel
lenteducati
onenvi
ronmentwit
hthet echnical
capabil
it
yint
hef i
eldofITengi
neer
ingtoser
vev i
brantIndustr
y&
Societ
y.
Mi
ssi
on
Faci
li
tat
eSt
udent
stol
ear
nthebasi
csofI
TEngi
neer
ingent
ail
ing
t
het
echni
calgai
n.
Tr
ainSt
udent
swi
tht
echni
calski
ll
swi
thr
ati
onalcapaci
tyt
omeet
t
her
equi
rement
sofi
ndust
rywi
tht
echnol
ogi
cal
aspect
.
Mot
ivat
ethest
udent
sforanadv
anceknowl
edgei
nITengi
neer
ing
andot
herv
alueaddedpr
ogr
amsf
ort
hei
rhol
ist
icdev
elopment
.
I
mpar
ti
ngEt
hicalv
alues,
leader
shi
pandSoci
alv
aluei
nSt
udent
s
whi
cht
ransf
ormt
hem i
ntogoodhumanbei
ng.
Pr
ovi
deanacademi
cenv
ironmentandconsul
tancyser
vicest
othe
i
ndust
ryandsoci
etyi
nthear
eaofI
T&Comput
erengi
neer
ing.
FC5462OPERATI
NGSYSTEM
COURSEOUTCOMES(
COs)
Att
heendoft
hiscour
se,
studentwi
l
lbeabl
eto:
-
1)I
nstalloper
at i
ngsy st
em andconf i
gureit.
2)Useoper at
ingsy st
em toolstoperformv ar
iousfunct
ions.
3)Execute pr ocess commands f or performi
ng pr ocess management
operati
ons.
4)Applyschedul ing al
gori
thmst o cal
culat
et ur
naround ti
meand av er
age
waiti
ngtime.
5)Calcul
ateeffici
encyofdiffer
entmemor ymanagementt echni
ques.
6)Applyfil
emanagementt echniques.
FC5462OPERATI
NGSYSTEM
Pr
act
ical1:
Ai
m:Inst
all
andconf
igur
eLi
nux(
oral
i
ke)oper
ati
ngsy
stem.
Software&HardwareRequi
rement:
-mi
nimum 4gbr
am,
512gbhddor256ssd,
i3
8thgenorhi
gherpr
ocesserr
equi
red.
Pr
ocedur
e:
St
epstoi
nst
all
li
nux
:
I
nst
all
LinuxUsi
ngCD-
ROM orUSBSt
ick
Downl
oad.i
soort
heISOfil
esonacomputerfr
om thei
nter
netandst
oreiti
nthe
CD-
ROM orUSBst
ickaf
termaki
ngitboot
ableusi
ngPenDriveLi
nuxand
UNet
Booti
n
1.Booti
ntot
heUSBSt
ick
Note:
-
Youwill
seeanewscr
eenwheny
ourcomput
erboot
supcal
l
ed“
GNUGRUB”
,a
FC5462OPERATI
NGSYSTEM
bootl
oaderthathandlesi
nst
all
ati
onsforLi
nux.Thi
sscr
eenwi
l
lonl
yappeari
n
caset
hereismor ethanoneoperat
ingsyst
em.
Sett
hekeyboardl
ayout.
Nowy ouwi
llbeaskedWhatappswouldyoul
i
ketoinst
all
t ostar
twit
hLi
nux?
Thetwoopti
onsare‘Normal
inst
all
ati
on’
and‘
Mini
mal i
nstall
ati
on’
.
2.Der
iveSel
ect
ion
Selectt
hedr i
veforinst
all
ati
onofOStobecomplet
ed.Sel
ect“
EraseDisk
and i
nstall
Ubuntu”incaseyouwanttorepl
acet
heexi
sti
ngOSot her
wisesel
ect
“Somethingelse”opti
onandcli
ckINSTALLNOW.
FC5462OPERATI
NGSYSTEM
3.St
artI
nstal
lat
ion
As mall
panelwil
laskforconfi
rmati
on.Cl
ickCont
inueincaseyoudon’
t
wanttochangeanyinf
ormat i
onprovi
ded.Sel
ecty
ourlocati
ononthemap
andinst
allLi
nux.
Provi
dethelogi
ndetai
l
s.
4.Compl
etet
hei
nst
all
ati
onpr
ocess
Af
tert
hei
nst
all
ati
oni
scompl
etey
ouwi
l
lseeapr
omptt
orest
artt
hecomput
er.
FC5462OPERATI
NGSYSTEM
Youcanalsodownl oaddriv
ersofyourchoicethroughtheSy st
em Setti
ngsmenu.
Justfol
lowthesesteps:
Addit
ionalDr
ivers>selectt
hegraphi
csdr i
verfrom thel
ist.
Manyusefuldriv
erswillbeavai
l
ableinthelist
,suchasWi -Fidri
vers.
Therearemanyot heropti
onsalsoavai
labl
et ouseandi nstal
lLinux
Resul
t:ThusIhav
einst
all
edandconf
igur
eLi
nux(
ubunt
u)OSbyusi
ngDual
-Boot
method.
FC5462OPERATI
NGSYSTEM
Practical2:
Aim: Executegener
alpurposecommandsdate,
time,
cal
,cl
ear
,banner
,tt
y,scr
ipt
,
man.
Softwar eRequi
rements:
-LinuxOS,
Terminal
.
Procedur e:
-
Sr
. Commands Meani
ng
No.
1 date I
tdisplayssystem dateandt i
me
2 cal Displ
ayscalendarf orcurr
entmont
h
3 cl
ear Clear
st hescreen
4 banner Displ
aysanar gumentst ri
ngasapost
erwi
thmaxof
10char sperli
ne
5 tt
y Namet hetermi nal
6 scri
pt Recordloginsession
7 man I
tgivesmanual hel
pf oranycommand
1)$date
Output
:TueFeb215:
20:
21I
ST2021
2)$cal
Output
:
Feb2021
SuMoTuWeThFrSa
1 2 3 4 5 6
7 8 9 10 111213
14 1516 17 181920
21 2223 24 252627
28
3)
$clear
-
The
clear
commandi
susedt
ocl
eart
het
ermi
nal
scr
een.
4)
$bannerI
T
Output
:
### #######
# #
# #
# #
# #
# #
FC5462OPERATI
NGSYSTEM
### #
5)
$t t
y
Output
:/dev
/pt
s/1
6)
$scri
ptmyfi
l
e.txt
-
Scri
ptst
art
ed,f
il
eismy
fil
e.t
xt
7)
$man
-sy
ntax:$man[OPTI
ON]
..
.[COMMANDNAME]
..
.
$manpr i
ntf
Output
:
Resul
t:ThusIhav
eExecut
egener
alpur
posecommands.
FC5462OPERATI
NGSYSTEM
Practi
cal3:
Aim: Workwit
hmulti
pleLi
nuxter
minalandbasi
ccommands:
who,
whoam i
,l
ogi
n,
passwd,su,pwd.
SoftwareRequir
ements:
-Li
nuxOS, Ter
minal
.
Procedure:
Followi
ngarebasi
cUni
xCommands:
1.who
2.whoam i
3.pwd
4.login
5.passwd
6.su
Tabl
e1:Char
act
er Sy
ntax Expl anation
Who $Who Displ aysthenamesof
alluser swhoar e
cur r
ent l
yloggedi n
whoam i $whoam i Displ aysthenameof
cur r
entuser
Pwd $Pwd Displ aysthef ul
lpat h
nameoft hecur rent
direct or
y
Logi
n $Logi
n[name] Itisusedwhen
signi ngontoa
syst em.Itcanal sobe
usedt oswi t
chf rom
oneusert oanot herat
anyt i
me
Passwd $Passwd Changet hecur rent
user ’spasswor d.The
commandpr omptf or
thenewpasswor d.
Su $Su Itisusedt oruna
commandasa
differentuser .
Examples:
1.who
Thiscommanddi
spl
ayst
hei
nfor
mat
ionofuser
swhoar
ecur
rent
lyl
oggedi
n.
Syntax:$who
FC5462OPERATI
NGSYSTEM
Exampl
e:
2.whoam i
Thiscommanddispl
ayst
hei
nfor
mat
ionoft
heuserwhoi
scur
rent
lyl
oggedi
n.
Syntax:$whoam i
Example:
3.pwd(
pri
ntwor
kingdi
rect
ory
)
Thiscommanddi
spl
ayst
heabsol
utepat
hoft
hecur
rentwor
kingdi
rect
ory
.
Syntax:$pwd
Example:
4.l
ogi
n
Tologintothesy st
em asuserabc,ent
erthef
oll
owingattheloginprompt
Syntax:$l
ogin:abc
I
fapasswor disdefined,
thepasswordpromptappear
s.Enteryourpasswor
dat
thi
sprompt.
5.passwd
Thiscommandchangest heol
dpasswor
doft
hecur
rentusert
othenewone.
Syntax:$passwd
Changi ngpasswordfortheuserpr
amod.
Changi ngpasswordforpramod
(Current)UNIXpassword:
Newpasswor d:
Retypenewpasswor d:
FC5462OPERATI
NGSYSTEM
$
Exampl
e:
6.su
Thesu( shor tforsubst i
tuteorswi tchuser )util
i
tyall
owsy outoruncommands
withanot heruser ’
spr i
vil
eges, bydef aul
tther ootuser.
Usingsui sthesimpl estwayt oswi tchtot headmi ni
str
ati
v eaccountinthecurr
ent
l
oginsessi on.Thisisespeci all
yhandywhent herootuserisnotall
owedt ologin
tothesy stem throughorusi ngt heGUIdi splaymanager
Wheni nv okedwi thoutanyopt ion,thedef aultbehavi
ourofsui storunan
i
nteracti
v eshel l
asr oot:
Syntax: $su
Youwi llbepr ompt edtoent ert herootpasswor d,andifauthenti
cated,t
heuser
runningthecommandt empor ari
lybecomesr oot.
Toconf i
r mt hattheuseri schanged, usethewhoam i command:
Syntax:$whoam i
Exampl e:
Thecommandwi
l
lpr
intt
henameoft
heuserr
unni
ngt
hecur
rentshel
lsessi
on:
root
.
Resul
t:ThusIhav
eexecut
edbasi
ccommandi
nter
minal
ofl
i
nux.
FC5462OPERATI
NGSYSTEM
Pr
act
ical4:
Command Function
i Insert
st exttoleftofcur sor
l Insert
st extatbegi nningof
cursor
a Appendst exttorightofcur sor
A Appendst extatendofl i
ne
o Opensl i
nebel ow
O Opensl i
neabov e
r
ch Replacessi nglechar acterunder
cursorwi t
hchar act er
R Replacest extfrom cur sorto
right
s Replacessi nglechar acterunder
sursorwi t
hanynumberof
characters
S Replacesent ir
el i
ne
i
i
)Pagi
ngFunct
ions
Command Funct
ion
<cont
rol
-f
> Scrol
l
sfull
page
for
ward
<cont
rol
-b> Scrol
l
sfull
page
FC5462OPERATI
NGSYSTEM
backward
<cont
rol
-d> Scrol
lshal
fpage
downwards
<cont
rol
-u> Scrol
lshal
fpage
upwards
<cont
rol
-l
> Redrawspagescreen
i
i
i)Cur
sorMov
ementCommands
Command Funct i
on
Horbackspace Mov escursorleft
j Mov escursordown
k Mov escursorup
l Mov escursorright
$ Mov escursortoendof
l
ine
b Mov escursorbackt o
beginningofwor d
e Mov escursorforwardto
endofwor d
w Mov escursorforwardto
beginningofwor d
^ Mov escursortobeginni
ng
offirstwordofline
0orl Mov escursortobeginni
ng
ofline
iv. Commandsf
orDel
eti
on, changingandYanking
Command
Function
D$orD Deletesf r
om cursorto
endofl ine
5dd Deletesf i
veli
nes
d30G Deletesf r
om cursorup
toli
nenumber30
co Changesf r
om cursorto
beginningofline
FC5462OPERATI
NGSYSTEM
v
)Yanki
ng(
copy
ingt
ext
)usi
ngy
y
yycommandy anksacopyofcur r
entlinei nt
oabuffer
P commandput sl i
neinbufferaftercursor
pcommandput slineinbuff
erbef orecur sor
“r
egYYyanksal i
nei nt
obufferregisterreg.
n”r
egYYyanksnlinesintobufferregisterreg.
“r
egPput
st hecontentsofregisterregaf tercur
sor
.
vi
)ColonModeCommands
Savi
ngtextandqui
ti
ngv
i
Commands Acti
ons
:
w Savesfi
lesandremainsin
edi
tingmode
:
x Savesfi
lesandquit
sediti
ng
mode
:
wq Savesfi
lesandquit
sediti
ng
mode
:
q Quit
sediti
ngmodewhenno
changesaremadet ofi
le
:
sh Escapetotheunixshel
l
vi
i)Setoptionsusedbyv
i i
ncol
onmode/exmode
Option Abbr
evi
ati
on Signi
fi
cance
Autoindent ai Nextli
nestart
satthe
previ
ousindent
ed
I
gnor ecase i
c Ignor
ecasewhi l
e
FC5462OPERATI
NGSYSTEM
i
)Abbr eviat
ionsusi ngabbrcommand: Theabbrcommandi susedt oexpand
shortstri
ngst ol ongwor ds.Theabbrcommandi nthecolonmodemapst hefirst
argumentt ot hef ollowingstring.
Forexampl e:
:abbrGPAGov er nmentPol y t
echnicAmr avat
iThi
sindicat
esthatwheny ouent er
thewor dGPAf ollowedbyakeywhi chisneit
heral
phanumericnortheunder score
character,t
hewor ds“Gov ernmentPol y
technicAmravati
”wouldbesubst itut
edi n
placeofthest r
ing.
i
i)Mapcommand: Mapcommandi scolonmodecommandusedt oassi gn
undefinedkey sorr eassigndef i
nedonessot hatwhensuchakeyi spr essed, i
t
expandsi ttoacommandsequence.I tisparti
cul
arl
yusefult
oconver tasequence
ofkeystrokesi ntoamacr o.Intheexmode( :mode),
themapcommandi s
foll
owedbyt hekeywhi chneedsmappi ngandthekeysequencewhi chismapped.
GUI :
Linuxsyst
em pr
ovidesbotht
heint
erfacethatisGUIandCLI.Asperthe
requir
ementyoucandecidewhenyoushoul duseLinuxcommandlineint
erf
ace
(CLI)andwhenyoushoulduseagraphicaluseri
nterf
ace(GUI
).
Fi
leHandl
i
ng:
AlldatainLinuxi sorganizedintofil
es.Allf
ilesareorganizedint
odi rectori
es.
Thesedi r
ect ori
esar eorganizedint
oat ree-
likestruct
urecall
edt hef i
lesystem.
Wheny ouwor kwi t
hLi nux,onewayoranot her ,
youspendmostofy ourti
me
wor ki
ngwi thfil
es.
I
nLi nux,therearet hreebasictypesoffil
es−
OrdinaryFil
es−Anor dinaryfi
leisafil
eont hesy stem t
hatcontainsdat a,tex
t,or
program instructi
ons.Int hi
stutori
al,
youlookatwor ki
ngwi t
hor dinaryfil
es.
FC5462OPERATI
NGSYSTEM
Dir
ectori
es−Direct
ori
esstorebothspeci al
andordinaryf
il
es.Forusersfamil
iar
withWindowsorMacOS, Linuxdirectori
esareequival
enttofol
ders.
Special
Fil
es−Somespeci alfi
l
espr ovideaccesstohardwaresuchashar ddriv
es,
CD-ROM dri
ves,modems,andEt hernetadapter
s.Otherspeci
alfi
lesaresimil
arto
al
iasesorshort
cutsandenableyout oaccessasinglefil
eusingdiff
erentnames.
b)Runcommandst ostart
,st
opandr est
artt
hespeci
al ser
vicei
nLi
nux.
Foll
owi
ngaretheprocesscommands:
Commandt oaddandr emoveser
vicesinyoursy
stem star
t-
up:
Usechkconfi
g
.
Torest
artservi
ce–
sudoserv
iceapache2rest
art
Tostoptheservi
ce–
sudoser
viceapache2st
op
Tostar
ttheservi
ce–
sudoser
viceapache2st
art
FC5462OPERATI
NGSYSTEM
PracticalNo5:
Aim: Executeprocesscommands-ps, wai
t,sl
eep,
exi
t,ki
l
l.
Softwar eRequirements:-Li
nuxOS,Ter
minal.
Procedur e:
-
Steps:-
1.Startthepc/laptopandbootint
oLinuxOS.
2.Opent er
minal f
orexecuti
onofcommands.
1)PS:
-Thiscommandst andsfor'Pr
ocessStat
us'
.I
tissi
mil
artothe"Task
Manager"thatpop-
upsi
naWi ndowsMachinewhenweuseCnt r
l+Al
t+Del
.This
commandi ssimil
arto'
top'commandbuttheinfor
mati
ondispl
ayedisdif
fer
ent.
2)
Wait:
-wai
tisabui
l
t-i
ncommandofLi
nuxt
hatwai
tsf
orcompl
eti
nganyr
unni
ng
pr
ocess.
3)Sleep:-Sleepcommandisusedtodelayf
orafixedamountofti
meduringthe
executionofanyscri
pt
4)Exit:
-exitcommandinli
nuxisusedtoexi
ttheshell
whereiti
scurr
ent
lyrunni
ng
FC5462OPERATI
NGSYSTEM
5)Ki
ll
:-ki
llcommandinLinux(l
ocat
edin/
bin/
kil
l
),i
sabui
l
t-i
ncommandwhi
chi
s
usedtoterminat
eprocessesmanual
ly
.
Resul
t:
-ThusIhav
eexecut
edpr
ocesscommands-ps,
wai
t,sl
eep,
exi
t,ki
l
lonl
i
nux
ter
minal
.
Practi
calNo.6:
Aim: Wri
teapr ogr am t
ocalculat
et otalwaiti
ngandt urnaroundti
meofn
processeswithFi rstComeFi r
stSer v
eCPUschedul i
ngalgorit
hm.
SoftwareRequi rements:Li
nuxOS, Termi nal
,edit
or,GCC+.
Procedure:
-
Steps:-
1.Startt
hepc/ laptopandbooti ntoLinuxOS.
2.Opent er
mi nal f
orexecut
ionofpr ogr am
3.Openedi t
orandwr it
ecodeandsav einto.
cext ensi
on.
4.Compi l
ewi thgccosos. ccommandont erminal
5.Runbyusi ng. /oscommandont erminal.
6.Outputwillbedi spl
ayont er
mi nal
Code:
#include<stdio.
h>
voidf i
ndWai t
ingTi
me(intpr
ocesses[
],i
ntn,
i
ntbt []
,intwt[]
)
{
wt[0]=0;
for(i
nti =1; i<n;i++)
wt[i
]=bt [
i-
1]+wt [
i-
1];
}
voidf i
ndTurnAroundTi
me(intprocesses[
],
intn,
FC5462OPERATI
NGSYSTEM
i
ntbt []
,intwt [],i
ntt at[])
{
for(inti =0; i <n; i++)
tat
[i]=bt [i]+wt [i]
;
}
voidf i
ndav gTi me(i ntpr ocesses[],intn,i
ntbt[
])
{
i
ntwt [
n], tat[n] ,total_wt=0, total
_tat=0;
fi
ndWai ti
ngTi me( processes, n,bt
, wt);
fi
ndTur nAr oundTi me( processes, n,bt,wt,t
at)
;
pri
nt f(
"Pr ocessesBur stt i
meWai tingtimeTurnaroundt
ime\
n")
;
for(inti=0; i
<n; i++)
{
total_wt=t ot al _wt+wt [i]
;
total_t
at=t ot al_tat+t at[i
];
pri
nt f(
"%d" ,(i+1) )
;
pri
nt f(
"%d" , bt [
i]);
pri
nt f(
"%d" ,wt [
i]);
pri
nt f(
"%d\ n" ,tat[i
]) ;
}
i
nts=( float )tot al_wt/( float)n;
i
ntt =(fl
oat )
t ot al_t
at/( float)n;
pri
nt f(
"Av er agewai ti
ngt ime=%d" ,
s);
pri
nt f(
"\n" );
pri
nt f(
"Av er aget urnar oundt i
me=%d" ,t
);
}
i
ntmai n()
{
i
ntpr ocesses[ ]={1, 2, 3};
i
ntn=si zeofpr ocesses/si zeofprocesses[0]
;
i
ntbur st _time[ ]={ 10, 5, 8};
fi
ndav gTi me( processes, n,burst_ti
me) ;
ret
ur n0;
}
Out
put
:
FC5462OPERATI
NGSYSTEM
Result:ThusIhav
eexecutedthepr
ogr
am tocal
cul
atet
otalwai
ti
ngand
turnar
oundt i
meofnprocesseswit
hFi
rstComeFir
stServ
eCPUscheduli
ng
algori
thm.
FC5462OPERATI
NGSYSTEM
Practi
calNo.7:
Aim: Wri
tea'C' program t
oimplementFI FOpager epl
acemental
gor
it
hm.
SoftwareRequi rements:Li
nuxOS, Terminal
,edit
or,GCC+.
Procedure:
-
Steps:-
1.Startt
hepc/ laptopandbootintoLinuxOS.
2.Opent er
mi nal f
orexecuti
onofprogram
3.Openedi t
orandwr it
ecodeandsav einto.cextensi
on.
4.Compi l
ewi thgccosos. ccommandont erminal
5.Runbyusi ng. /oscommandont er
mi nal
.
6.Outputwillbedi spl
ayonterminal
Code:
#include<stdio.h>
i
ntmai n()
{
i
ntr eference_string[10],
page_fault
s=0, m,n,s,
pages,
frames;
printf
("\nEnterTot alNumberofPages: \t
");
scanf (
"%d" ,
&pages) ;
printf
("\nEnterval uesofRef er
enceStr
ing:\
n")
;
for(m =0; m <pages; m++)
{
printf
("ValueNo.[ %d]:
\t"
,m +1) ;
scanf (
"%d" ,
&refer ence_str
ing[
m]);
}
printf
("\nEnterTot alNumberofFr ames:\t"
);
}
scanf (
"%d" ,
&frames) ;
}
i
ntt emp[ fr
ames] ;
for(m =0; m <f rames; m++)
{
temp[ m]=- 1;
}
for(m =0; m <pages; m++)
{s=0;
for(n=0; n<f rames; n++)
{
i
f(reference_stri
ng[ m]==t emp[n])
{
s++;
page_ fault
s--;
}
}
FC5462OPERATI
NGSYSTEM
page_fault
s++;
i
f((page_f
ault
s<=f r
ames)&&( s==0))
{
temp[m]=r ef
erence_st
ri
ng[m];
}
elseif(
s==0)
{
temp[(page_f
ault
s-1)%f rames]=r
efer
ence_
str
ing[
m];
}
print
f("
\n")
;
for
(n=0; n<f rames;n++)
{
pri
ntf
("%d\t"
,temp[n]
);
}
}
pri
ntf
("\nTot
al PageFault
s:\
t%d\
n",
page_
faul
ts)
;
ret
urn0;
}
Output:
Resul
t:ThusIhav
eexecut
eda'
C'pr
ogr
am t
oimpl
ementFI
FOpager
epl
acement
al
gori
thm.
FC5462OPERATI
NGSYSTEM
PracticalNo.8:
Aim: Executefi
leanddi r
ector
ymanipul
ationcommands—l s,r
m,my
,cp,
joi
n,spl
i
t
,cat( fi
lesavi
ngandr edir
ecti
onoperat
or),head,
tai
l
,touch.
Softwar eRequirements:Li
nuxOS,Terminal.
Procedur e:
-
Steps:-
1.Startthepc/laptopandbootint
oLinuxOS.
2.Opent er
minal f
orexecuti
onofcommands.
1)
Ls:Thi
scommanduset
oli
stofal
li
temspr
esenti
nthecur
rentdi
rect
ory
.
2)
Rm:
Thi
scommanduset
oremov
efi
l
eint
hecur
rentdi
rect
ory
.
FC5462OPERATI
NGSYSTEM
3)
Mv:Thi
scommanduset
omov efi
l
esinonedi
rect
oryt
oanotherone.
4)
Cp:Thi
scommanduset
ocopysel
ect
edfil
edatai
ntoanot
herfi
le.
FC5462OPERATI
NGSYSTEM
5)Join:Thi
scommandusetojoinonefi
l
edatatoanotheronel
ikeonef
il
econtent
1,2,
3,4andanot
heronecont
ainsABC,BCD, CDEthenthi
scommandassignthe
value1,
2,3,
4toABC,BCD,CDE,CDE,r
espect
ivel
yandsavedinanot
herf
il
e.
6)
Spl
it
:Thi
scommanduset
ospl
i
tthef
il
esi
nxaaf
il
eaut
omat
ical
l
y.
FC5462OPERATI
NGSYSTEM
7)
Cat
:Thi
scommanddi
spl
aysal
lpr
esentv
aluesi
nsel
ect
edf
il
eont
ermi
nal
.
8)Head:Thi
scommanddi
spl
ayst
hepr
esentv
aluesi
nfi
l
esupt
oindex10i
n
sequent
ial
ly
.
9)Tai
l:Thiscommanddi
spl
ayst
hepr
esentv
aluesi
nfi
l
esupt
oindex10i
n
descendingorder
.
FC5462OPERATI
NGSYSTEM
10)
Touch:
Thi
scommanduset
ocr
eat
enewf
il
esi
ndi
rect
ory
.
Result
:ThusIhaveexecut
eddir
ectorymanipul
ati
oncommands—l s,r
m,my
,cp,
j
oin,spl
it
,cat(
fi
lesav
ingandr
edirect
ionoperat
or)
,head,
tai
l
,touch.
FC5462OPERATI
NGSYSTEM
PracticalNo.9:
Aim: Executefil
eanddi r
ect
orymani pul
ationcommands—di
ff
,comm.
,pr
,chmod,
mkdir, r
mdir,cd,pwd,dir
,cmp.(Usewi l
dcar dchar
act
er)
.
Softwar eRequirements:Li
nuxOS, Terminal.
Procedur e:
-
Steps:-
1.Startthepc/ l
aptopandbootintoLinuxOS.
2.Opent er
minal f
orexecut
ionofcommands.
1)
Dif
f:Thi
scommanduset
ofi
nddi
ff
erencebet
weeni
nfi
l
es.
2)
Comm:
Thi
scommanduset
ofi
ndcommonv
aluepr
esenti
nfi
l
es.
FC5462OPERATI
NGSYSTEM
3)
Pr:Thi
scommanduset
odef
inev
aluesi
nthef
il
esi
nrows.
4)
Chmod:
Thi
scommanduset
ochanget
heper
missi
onoff
il
e.
FC5462OPERATI
NGSYSTEM
5)
Mkdi
r:Thi
scommanduset
omakef
olderi
ncur
rentdi
rect
ory
.
6)
Rmdi
r:Thi
scommanduset
odel
etef
olderi
ncur
rentdi
rect
ory
.
7)
Cd:Thi
scommanduset
ogobackt
orootf
olderf
orm cur
rentdi
rect
ory
.
FC5462OPERATI
NGSYSTEM
8)
Dir
:Thi
scommanddi
spl
ayal
ldi
rect
oryandf
il
escont
ainsi
ncur
rentl
ocat
ion.
9)
Cmp:Thi
scommanduset
ocompar
ethef
il
esi
nby
te.
Resul
t:Ihav
eex ecut
eddir
ect
orymani
pul
ati
oncommands—di f
f,comm.
,pr
,
chmod,mkdir,
rmdir,
cd,pwd,
dir,
cmp.(
Usewil
dcar
dcharact
er).
FC5462OPERATI
NGSYSTEM
Practi
calNo10:
Aim: Wr i
teandex ecut eShellScri
ptbyusingf ol
l
owingContr
olstat
ements
feat
ures-" i
f'statement ”.
Softwar eRequi rement s:LinuxOS, Terminal,
Edit
or.
Procedur e:
-
Steps:-
1.Startthepc/ lapt opandbooti ntoLinuxOS.
2.Opent er
mi nal forexecutionofcommands.
3.Openedi torcr eat efi
lewith.shExtension.
4.Wr i
teacodei nf i
le.
5.Savei t
6.Opent er
mi nal andt ypebash-ffil
ename. shandpressent
erbutt
onfor
execution.
7.Outputdi splayont erminal.
Code:
a=10
b=20
i
f[$a==$b]
then
echo“ai
sequalt
ob”
fi
i
f[$a!=$b]
then
echo“ai
snotequal
tob”
fi
FC5462OPERATI
NGSYSTEM
Out
put
:-
Result
:Ihaveexecut
edShel
lScr
iptbyusi
ngf
oll
owi
ngCont
rol
stat
ement
s
feat
ures-"
if
'st
atement”
.
Practi
calNo11:
Aim: Wr i
teandex ecut eShellScri
ptbyusingf ol
l
owingContr
olstat
ements
feat
ures-" f
or"st atement ,exit
,br
eak,continue.
Softwar eRequi rement s:LinuxOS, Terminal,
Edit
or.
Procedur e:
-
Steps:-
1.Startthepc/ lapt opandbooti ntoLinuxOS.
2.Opent er
mi nal forexecutionofcommands.
3.Openedi torcr eat efi
lewith.shExtension.
4.Wr i
teacodei nf i
le.
5.Savei t
6.Opent er
mi nal andt ypebash-ffil
ename. shandpressent
erbutt
onfor
execution.
7.Outputdi splayont erminal.
Code:
1)Forl
oop:
forii
n{1..5}
;
do
echo“Number :
$i”
done
echo“AlldonebyAnandKal
e”
Output:
FC5462OPERATI
NGSYSTEM
2)Breakst at
ement:Thi
sst
atementuset
obr
eakt
hel
oopaf
tercondi
ti
oni
str
ue.
Code:
forii
n{1..10}
;
do
echo“Number :$i”
i
f[[$i-eq6]];then
break
fi
done
echo“AlldonebyAnandKal
e”
Output:
FC5462OPERATI
NGSYSTEM
3)Cont i
nuestatement
:Thi
sstat
ementuset
oski
pthev
aluewhi
chi
spr
esenti
nif
condit
ion.
Code:
forii
n{ 1..
10}
;
do
i
f[[$i-eq6]];then
conti
nue
fi
echo“Number :$i”
done
echo“Al l
donebyAnandKale”
Output:
Result
:Ihaveex
ecutedShel
lScr
iptbyusi
ngf ol
l
owi
ngCont
rol
stat
ement
s
feat
ures-"
for
"st
atement,
exi
t,br
eak,cont
inue.
FC5462OPERATI
NGSYSTEM
Practi
calNo12:
Aim: Wr i
teShel lscr i
pttofi
ndoutwhet her-Fi
lehasr
ead,wri
te,
andexecute
permissions?
Softwar eRequi rement s:Li
nuxOS,Ter minal,
Edit
or.
Procedur e:
-
Steps:-
1.Startthepc/ lapt opandbootint
oLi nuxOS.
2.Opent er
mi nal forexecut
ionofcommands.
3.Openedi torcr eat efi
lewit
h.shExtension.
4.Wr i
teacodei nf i
le.
5.Savei t
6.Opent er
mi nal andt y
pebash-ffi
lename. shandpressent
erbut
tonfor
execution.
7.Outputdi splayont ermi
nal.
Code:
echo-n“Enterf
il
ename: ”
readfi
le
[-
w$fil
e]&&W =” Writ
e=y es”|
|W =”Wri
te=No”
[-
x$fi
le]&&X=” Ex ecute=yes”|
|X=”Execut
e=No”
[-
r$fi
l
e]&&R=” Read=y es”|
|R=”Read=No”
echo“$fi
lepermissions”
echo“$W”
echo“$R”
echo“$X”
echo“AlldonebyAnandKal e”
Out
put
:-
FC5462OPERATI
NGSYSTEM
Result
:-Ihaveexecut
edShel
lscr
iptt
ofi
ndoutwhet
her-
Fil
ehasr
ead,
wri
te,
and
execut
eper missi
ons?
FC5462OPERATI
NGSYSTEM