Assignment: TB (Compulsory) PART - A 1. What are the different standard gien !y P"#$%& What is P"#$%& n!: The di""erent !tandard gi#en b$ P%SIX are: - P%SIX&' P%SIX&'B P%SIX&'C P%SIX&( P%SIX:())' P%SIX:())4 P%SIX:())* P%SIX i! the Portable %+erating S$!tem Inter"ace, the o+en o+erating inter"ace !tandard acce+ted -orld--ide& It i! +roduced b$ I... and recogni/ed b$ IS% and NSI& '. "n (hi)h aria!le terminal setting is done& *ame any three terminal setting +eys. n!: U!ing STT0 three terminal !etting 1e$ are:- 2uit, 1ill, era!e& The en#ironment #ariable T.34 i! u!ed to identi"$ the t$+e o" terminal 5or terminal emulator6 to the cur!e! librar$ and +rogram! that u!e the cur!e! librar$ to di!+la$ te7t& It i! al!o a!!ociated -ith the T.34IN8% and 5in archaic !$!tem!6 T.34CP en#ironment #ariable! ,. -.plain +ey features of /*$%. n!: The UNIX !$!tem i! !u++orted b$ the "ile and the +roce!!& 9irectorie! and de#ice! are treated a! "ile! and there are man$ te7t mani+ulation tool! to edit the!e "ile!& :hen a "ile i! e7ecuted a! a +rogram, it i! called a +roce!!& There are tool! to control +roce!!e! li1e !ending a +roce!!e! into bac1ground or e#en terminating it& UNIX i! a multita!1ing o+erating !$!tem, -hich allo-! the com+uter to run !e#eral +rogram! at the !ame time& B$ going 2uic1l$ "rom one ta!1 to another and +er"orming a little bit o" each ta!1 e#er$ time, the o+erating !$!tem gi#e! an im+re!!ion o" doing man$ thing! at the !ame time& UNIX u!e! thi! techni2ue o" time-!haring& UNIX i! al!o able to interact -ith more than one u!er at a time& Thi! "eature o" UNIX ma1e! it a multita!1ing !$!tem& 0. What is s)ript )ommand1 (ith )ommand e.plain ho( to )reate s)ript file of a session& n!: ;!cri+t; i! t$+icall$ a ;!creen ca+ture; o" command! being e7ecuted in the UNIX o+erating en#ironment& Creating a !cri+t "ile generall$ mean! that $ou are tr$ing to ca+ture in a te7t "ile, the interaction bet-een the o+erating !$!tem 5UNIX6 and the u!er& 4o!t o"ten thi! te7t "ile or ;!cri+t; i! then +rinted and turned in -ith a +rogram a!!ignment !o that the in!tructor can !ee that the +rogram e7ecuted correctl$& To create a ba!ic !cri+t "ile, do the "ollo-ing: '& Turn the !cri+t %N 5The de"ault name o" the "ile the !cri+t -ill record in i! al-a$! named t$+e!cri+t unle!! $ou name it !omething el!e a! !ho-n later6 at the command line !cri+t& 0ou -ill !ee a me!!age bac1 !tating: Scri+t command i! !tarted& 8ile i! t$+e!cri+t& (& .7ecute the command !e2uence that $ou -ant to ca+ture 5t$+icall$ thi! mean! ;run $our +rogram;6& ja#a Birthda$ 3& Turn o"" the !cri+t e7it 4& No- $ou !hould !ee a me!!age: Scri+t command i! com+lete& 8ile i! t$+e!cri+t& <& No- $ou ma$ +rint the "ile containing $our !cri+t, t$+e!cri+t, u!ing the a(+! command, or $ou ma$ -ant to loo1 at it on the !creen u!ing the more command& a(+! t$+e!cri+t to +rint the !cri+t "ile more t$+e!cri+t to #ie- the content! o" the !cri+t "ile on the !creen =& That>! all? @ere i! an e7am+le o" a !cri+t "ile creation: A!euAc!AhomeAu!erAlAlba1erA---A@T4BAco!c''(3 C !cri+t out+ut&t7t #)ript started1 file is output.t.t A!euAc!AhomeAu!erAlAlba1erA---A@T4BAco!c''(3 C ja#a Birthda$ @a++$ Birthda$ to $ou, @a++$ Birthda$ to $ou, @a++$ Birthda$ dear 9r& Camden @a++$ Birthda$ to $ou? A!euAc!AhomeAu!erAlAlba1erA---A@T4BAco!c''(3 C e7it Scri+t done, "ile i! out+ut&t7t A!euAc!AhomeAu!erAlAlba1erA---A@T4BAco!c''(3 C more out+ut&t7t Scri+t !tarted on Tue (= ug ())* )':43:<< P4 C9T A!euAc!AhomeAu!erAlAlba1erA---A@T4BAco!c''(3 C ja#a Birthda$ @a++$ Birthda$ to $ou, @a++$ Birthda$ to $ou, @a++$ Birthda$ dear 9r& Camden @a++$ Birthda$ to $ou? A!euAc!AhomeAu!erAlAlba1erA---A@T4BAco!c''(3 C e7it Scri+t done on Tue (= ug ())* )':44:)( P4 C9T A!euAc!AhomeAu!erAlAlba1erA---A@T4BAco!c''(3 C 2. What happens if a dire)tory permission )harged& n!: .#er$ time a "ile or a director$ i! created, de"ault +ermi!!ion! are e!tabli!hed "or it& The!e de"ault +ermi!!ion! are initiall$ a!!igned either b$ the o+erating !$!tem or the +rogram being run& Setting de"ault +ermi!!ion! !a#e! u! the trouble o" !+eci"$ing +ermi!!ion code! e7+licitl$ e#er$ time a "ile or director$ i! created& The o+erating !$!tem a!!ign! the de"ault +ermi!!ion #alue! o" DDD "or e7ecutable "ile! and === "or all other "ile!& To +ut "urther re!triction! on the +ermi!!ion! a!!igned b$ a +rogram -hen it create! a "ile or director$, a u!er ma!1 i! !+eci"ied -ith the uma!1 command& The u!er ma!1 i! a numeric #alue that determine! the acce!! +ermi!!ion! -hen a "ile or director$ i! created& Con!e2uentl$, -hen a "ile or director$ i! created, it! +ermi!!ion! are !et to the +ermi!!ion! !+eci"ied b$ the creating +rogram minu! the +ermi!!ion #alue! denied b$ the uma!1 #alue& .7am+le The command uma!1 -ithout argument! gi#e! the octal #alue o" the u!er ma!1& E uma!1 )(( 3. 4o( do you yan+ and paste lines& n!: The command >0> or >$$> co+ie! 5$an1!6 one or more line!& To co+$ one line, t-o line!, ') line!, and all line! to the end o" the "ile, re!+ecti#el$: 0 (0 ')0 $F to +a!te the te7t contained in the bu""er abo#e 5u++erca!e P6 or belo- the current cur!or +o!ition 5lo-erca!e +6, re!+ecti#el$: P + it i! al!o +o!!ible to $an1 te7t -ithin a line& The "ollo-ing command! $an1 te7t "rom the current cur!or +o!ition to the end o" the -ord and the end o" the line, re!+ecti#el$: $- $E The !ame command! +a!te the te7t -ithin a line& Bo-er ca!e + +a!te! a"ter the cur!or +o!ition and u++er ca!e P +a!te! be"ore& Pa!te -ill al!o -or1 -ith deleted te7t, either line! or +art! o" line!& Be care"ul not to e7ecute an$ other command! +rior to +a!ting a! thi! -ill em+t$ the bu""er& 5. 6ist out the different attri!utes of a file. n!: Bi!ting 8ile ttribute:- -r--r----- ' !ibna! !ibgr+ 4<=( !e+ (( '):3) -r--r----- ' !ibna! !ibgr+ *GD= !e+ (( '):3) -r--r----- ' !ibna! !ibgr+ ')(34 !e+ (( '):3) -r--r----- ' !ibna! !ibgr+ 43<( !e+ (( G:3) -r--r--r--r- ' !ibna! !ibgr+ *D=3( aug ( '':3) -r--r--r--r- ' !ibna! !ibgr+ =<(* june () '):3) -r--r--r--r- ' !ibna! !ibgr+ G(34 ma$ (( '):)) 8ile t$+e lin1 U!er id grou+ id "ile !i/e date & Count in b$te! o" modi& 7. What are the different (ays of )oming out of i after saing the file& n!: There are three di""erent -a$! to 2uit #i a"ter !a#ing the "ile: a& :-2 b& :7 c& HH 8. Write general synta. of CA#- statements. n!: The ca!e !tatement com+are! -ord -ith +atternI i" the$ match, the !hell run! the command on the "ir!t line& %ther-i!e the !hell chec1! the remaining +attern!, one b$ one, until it "ind! one that matche! the -ordI it then run! the command on that online& S$nta7 "or ca!e !tatement:- C?AbinA!h Set Jdate Ca!e E' in 8ri6 echo Kthan1 goodne!! it ! 8rida$?LII Sat M Sun6 echo K$ou !hould not -or1 on -ee1-end!LI .cho Klog o"" and go home?LII N6 echo Kit i! not $et the -ee1end&LI .cho Kget to -or1? KII e!ac 19. What is a pro)ess& *ame t(o important attri!utes of a pro)ess. n!: Proce!! i! born -hen a +rogram !tart! e7ecution and e7i!t! a! long a! the +rogram i! running& "ter e7ecution the +roce!! i! u!uall$ the name o" the +rogram being e7ecuted& The t-o im+ortant attribute o" a +roce!! are:- '6 The +roce!!-id5PI96&.ach +roce!! i! identi"ied b$ a uni2ue number called the +roce!!-id -hich i! allotted b$ the 1ernel -hen the +roce!! i! born& (6 The +arent PI95PPI96 the PI9 o" the +arent i! al!o a +roce!! attribute& :hen man$ +roce!!e! ha#e the !ame PPI9 it i! ea!ier to 1ill the +arent +roce!! rather than the children !e+aratel$& PART - B 1. a) -.plain layered ar)hite)ture of /ni. operating system. With a suita!le Command e.plain the intera)tion !et(een #hell and :ernel. n!: UNIX, li1e other o+erating !$!tem!, i! a la$er bet-een the hard-are and the a++lication! that run on the com+uter& It ha! "unction! that manage the hard-are "unction! that manage e7ecuting a++lication!& So -hatO! the di""erence bet-een UNIX and an$ other o+erating !$!temP Ba!icall$ t-o thing!: internal im+lementation and the inter"ace that i! !een and u!ed b$ u!er!& The +art o" UNIX that manage! the hard-are and the e7ecuting +roce!!e! i! called the 1ernel& The 1ernel i! collection o" +rogram! -ritten in c -hich directl$ communicate -ith the hard-are& ++lication +rogram! communicate -ith the hard-are b$ u!ing the !er#ice! o" Qernel& long -ith the memor$ management, the 1ernel al!o !chedule! +roce!!e! and decide! their +rioritie!& In the UNIX !$!tem, each hard-are de#ice i! #ie-ed a! a "ile and i! called a de#ice "ile &thi! allo-! the !ame !im+le method o" reading and -riting "ile! to be u!ed to acce!! each hard-are de#ice& The u!er command! are tran!lated in to action b$ the !hell -hich act! a! inter+reter& The !hell "orm! the outer +art o" the o+erating !$!tem! and "orm! the inter"ace bet-een the u!er and 1ernel& 8or each u!er logged in, there i! !hell in action& :hen a command i! gi#en b$ the u!er, it i! e7amined b$ the !hell and communicated to the 1ernel "or e7ecution& ++lication +ortabilit$ i! the abilit$ o" a !ingle a++lication to be e7ecuted on #ariou! t$+e! o" com+uter hard-are -ithout being modi"ied& Thi! can be achie#ed i" the a++lication u!e! the UNIX inter"ace to manage it! hard-are need!& !) -.plain uname )ommand (ith different options. n!: uname R di!+la$! the name o" the o+erating !$!tem S$nta7 uname So+tion!T .7am+le!: 9i!+la$! all the in"ormation Euname Ra SC%USV !co< 3&( <&)&< i3*= 9i!+la$! the machineO! node name in the communication net-or1& Euname-n Sco-< 9i!+la$! the o+erating !$!tem relea!e& Euname-r 3&( 9i!+la$! the name o" the o+erating !$!tem Euname R! SC%USV 9i!+la$! the o+erating !$!tem #er!ion Euname R# <&)&< 9i!+la$! the in"ormation about !$!tem name, node name, o+erating !$!tem relea!e number, 1ernel I9, +roce!!or t$+e, !erial number, number o" u!er! licen!e, %.4 number, origin number and number o" CPU!& '. a) -.plain the adantages of ispell1 list out the !asi) )ommands used in ispell. n!: I!+ell i! a !+ell-chec1ing +rogram a#ailable "or man$ UNIX im+lementation!& To u!e it, at $our UNIX !hell +rom+t, enter: ispell filename 3e+lace "ilename -ith the name o" the "ile $ou -i!h to chec1& Ba!ic I!+ell command! include: r 3e+lace the mi!!+elled -ord com+letel$& S+acebar cce+t the -ord thi! time onl$& a cce+t the -ord "or the re!t o" thi! I!+ell !e!!ion& i cce+t the -ord, ca+itali/ed a! it i! in the "ile, and u+date the +ri#ate dictionar$& u cce+t the -ord, and add a lo-erca!e #er!ion to the +ri#ate dictionar$& ), ', &&& n 3e+lace -ith the !ugge!ted -ord corre!+onding to that number& l 5the letter B6 Boo1 u+ -ord! in !$!tem dictionar$ 5controlled b$ the :%39S com+ilation o+tion6& 7 :rite the re!t o" thi! "ile, ignoring mi!!+elling!, and !tart the ne7t "ile& 2 .7it immediatel$ and lea#e the "ile unchanged& ? .!ca+e to the Uni7 !hell& Ctrl-l5the letter B6 3edra- the !creen& Ctrl-/ Su!+end I!+ell& P Sho- the hel+ !creen& !) -.plain uni. file system and gie the differen)e !et(een relatie and a!solute pathname. Ans: UNIX "ile !$!tem can be de"ined a! belonging to one o" "our +o!!ible t$+e!:- %rdinar$ "ile!: ordinar$ "ile! can contain te7t, data, or +rogram in"ormation& n ordinar$ "ile cannot contain another "ile, or director$& n ordinar$ "ile can be a te7t "ile or binar$ "ile& 4o!t o" the UNIX command are binar$ "ile!& 9irector$ "ile!: - 9irectorie! are container! that can hold "ile!, and other directorie!& director$ i! actuall$ im+lemented a! a "ile that ha! one line "or each item contained -ithin the director$& .ach line in a director$ "ile contain! onl$ the name o" the item, and a numerical re"erence to the location o" the item& S+ecial "ile!: - S+ecial "ile! re+re!ent IA% de#ice! li1e, a tt$, a di!1 dri#e, or a +rinter& Becau!e UNIX treat! !uch de#ice! a! "ile!& Some o" the command! u!ed to acce!! ordinar$ "ile! -ill al!o -or1 -ith de#ice! "ile!& Thi! allo-! more e""icient u!e o" !o"t-are& Bin1!:- lin1 i! a +ointer to another "ile& Since a director$ i! a li!t o" the name! and i-number! o" "ile!, director$ entr$ can be a hard lin1& In -hich the i-number +oint! directl$ to another "ile& hard lin1 to a "ile cannot be di!tingui!hed "rom the "ile it!el"& 9i""erence bet-een BS%UBT. N9 3.BTIV. PT@N4.S BS%UBT. PT@N4.S 3.BTIV. PT@N4.S n b!olute +athname !+eci"ie! the location o" a "ile & 3elati#e +athname !+eci"ie! a "ile in relation to the current director$& n b!olute +athname !tart! at the A root director$& 3elati#e +athname !tart! "rom the current director$& n b!olute +athname u!e! a !la!h 5A6 bet-een each director$ name in the +ath to indicate di""erent directorie!& In a 3elati#e +athname, a !ingle dot 5&6 re+re!ent! the current -or1ing director$ and t-o dot! 5&&6 re+re!ent the +arent o" the current -or1ing director$& ,. a) -.plain ho( to split file into multiple files. ;ie suita!le e.ample. n!: -e u!ed K!+litL command to !+lit "ile into multi+le "ile!& !+lit R !+lit large "ile! into K!maller "ile!L !$nta7 R !+litSo+tion!T "ilename +re"i7 -here "ile name i! the name o" the large "ile to be !+lit ,+re"i7 i! the name to be gi#en the !mall out+ut "ile! and o+tion! can either be e7cluded or can be one o" the or can be one o" the "ollo-ing:- -l W linenumber -b W b$te! I" Rl o+tion i! u!ed, linenumber -ill be the number o" the line! to be +ut in each o" the !maller "ile! 5the de"ault i! ')))6& I" the Rb o+tion i! u!ed, b$te! -ill be the number o" b$te! to be +ut in each o" the !maller "ile!& The !+lit command -ill gi#e each out+ut "ile created the name +re"i7 -ith an e7ten!ion attached to the end to indicate it! order .X4PB.: !!uming that "ile&t7t i! 3))) line! long , it -ill out+ut three "ile!, 7aa, 7ab, and 7ac, and each one -ill be '))) line! long& E !+lit"ile&t7t Thi! -ill out+ut !i7 !oo-line "ile!: "ileaa, "ileab, "ileac,"ilead, "ileae, and "ilea"& E!+lit-'<)) "ile&t7t "ile !!uming that "ile&t7t ha! ()) 1b, thi! -ill out+ut "i#e 4) 1b "ile!: "ileaa, "ileab, "ileac ,"ilead, "ileae, and "ilea"& E !+lit Rb 4)1 &t7t "ile !) ;ie the differen)e !et(een 4ard 6in+ and #ym!oli) 6in+. n!: So"t Bin1: - So"t lin1! are lin1! to a "ile but not the inode& - Created u!ing ln -! "ile' "ile( WX l! -il '3''3< lr-7r-7r-7 ' u!er u!er < Yul ') )G:)4 "ile( -X "ile' '3''3D -r--r--r-- ' u!er u!er 3< Yul ') )G:)3 "ile' - The inode "or "ile' i! '3''3D and inode "or "ile( i! '3''3<& - I" $ou !ee the +ermi!!ion bit!, there i! >l> in the "ront "or a !o"t lin1& - I" "ile' i! deleted, the lin1 !till e7i!t!& But i" $ou tr$ to #ie- "ile(, it! em+t$& Thi! mean! that once the main "ile i! deleted the data i! gone& @ard Bin1: - @ard lin1! are lin1! to inode - Created u!ing ln "ile' "ile( WX l! -il '3''3= -r--r--r-- ( u!er, u!er 4* Yul ') )G:(D "ile' '3''3= -r--r--r-- ( u!er, u!er 4* Yul ') )G:(D "ile( - The inode "or "ile' and "ile( i! the !ame 5'3''3=6& - I" $ou !ee the out+ut abo#e "or ;l! -i;, "ile( doe! not !ho- that it i! lin1ed to "ile'& In realit$ it i! not lin1ed to "ile' but it i! lin1ed to the inode& - I" $ou !ee that there i! number >(> be"ore the u!ername >u!er>& Thi! !ho-! the number o" hard lin1! to the inode& - I" "ile' i! deleted, the data i! not deleted& I" $ou #ie- "ile( the data i! !till there& 9eleting "ile' onl$ delete! a lin1& The data i! gone once the la!t hard lin1 i! deleted& 0. a) What is a pro)ess& -.plain the me)hanism of )reation in /*$%. n!: +roce!! i! a collection o" interrelated -or1 ta!1! initiated in re!+on!e to an e#ent that achie#e! a !+eci"ic re!ult "or the cu!tomer o" the +roce!!& dding more !+eci"ic detail to that general de"inition: That achie#e! a !+eci"ic re!ult: 4u!t deli#er a !+eci"ic re!ult thi! re!ult mu!t be indi#iduall$ identi"iable and countable a good +roce!! name clearl$ indicate! the re!ult or end !tate o" the +roce!! 8or the cu!tomer o" the +roce!!: cu!tomer recei#e! the re!ult or i! the bene"iciar$ o" it the cu!tomer can be a +er!on or an organi/ation cu!tomer can be identi"ied and can +a!! judgment on the re!ult and +roce!! cu!tomer +oint o" #ie- hel+! identi"$ and name the +roce!! accuratel$ Initiated in re!+on!e to a !+eci"ic e#ent: The +roce!! mu!t be initiated in re!+on!e to a !+eci"ic e#ent multi+le e#ent! can initiate a +roce!! ha#ing an e#ent N9 a re!ult allo-! the tracing o" the !e2uence o" ta!1! that turn! the e#ent into the re!ult :or1 ta!1!: collection o" action!, acti#itie!, !te+! or ta!1! ma1e u+ a bu!ine!! +roce!! a !te+ in the initial -or1"lo- -ill +robabl$ be di#ided into more detailed !te+! later collection o" interrelated: The +roce!! !te+! mu!t relate to each other interrelation!hi+ i! through !e2uence and "lo-&&&the com+letion o" one !te+ lead! to 5"lo-! into6 the initiation o" the ne7t !te+ al!o interrelated b$ dealing -ith the !ame -or1 item !te+! related b$ being traceable bac1 to the !ame initiation e#ent !) 6ist out the naigation +eys for the )ursor moement. n!: in the command mode ,na#igation 1e$! "or the mo#ement o" the cur!or b$ character!, -ord! and line! are a! "ollo-!: Qe$! 4o#ement o" cur!or @ Cur!or mo#e! le"t Y Cur!or mo#e! do-n Q Cur!or mo#e! u+ B Cur!or mo#e! right : :ord "or-ard B :ord bac1-ard . .nd o" -ord Z 8ir!t character E .nd o" line ) Beginning o" line The !creen di!+la$ can be controlled b$ !crolling the di!+la$ "or-ard and bac1-ard u!ing the "ollo-ing 1e$!:- Qe$! Screen di!+la$ Sctrl-"T Scroll di!+la$ "or-ard Sctrl-hT !croll di!+la$ bac1-ard Sctrl-dT Scroll hal"-!creen "or-ard Sctrl-uT Scroll hal"-!creen bac1-ard 2. a) -.plain grep )ommand (ith at least 2 e.amples (ith different options. n!: '6 !im+le Binu7 gre+ e7am+le - !earching "or a te7t !tring in one "ile Thi! "ir!t gre+ command e7am+le !earche! "or all occurrence! o" the te7t !tring >"red> -ithin the ;AetcA+a!!-d; "ile& It -ill "ind and +rint 5on the !creen6 all o" the line! in thi! "ile that contain the te7t !tring "red, including line! that contain u!ername! li1e ;"red; - and al!o ;al"red;& gre+ >"red> AetcA+a!!-d In a !im+le gre+ e7am+le li1e thi!, the 2uote! around the !tring "red aren>t nece!!ar$, but the$ are needed i" $ou>re !earching "or a !tring that contain! !+ace!, and ma$ be needed -hen $ou get into u!ing regular e7+re!!ion! 5!earch +attern!6& (6 Binu7 gre+ command - !earching "or a !tring in multi+le "ile! %ur ne7t gre+ command e7am+le !earche! "or all occurrence! o" the te7t !tring joe -ithin all "ile! o" the current director$: gre+ >joe> N The >N> -ildcard matche! all "ile! in the current director$, and the gre+ out+ut "rom thi! command -ill !ho- both 5a6 the matching "ilename and 5b6 all line! in all "ile! that contain the !tring >joe>& ! another e7am+le, $ou can al!o u!e gre+ to !earch all "ile! in the current director$ that end in the "ile e7ten!ion ;&t7t;, a! !ho-n here: gre+ >joe> N&t7t 36 Ca!e-in!en!iti#e "ile !earching -ith the Uni7 gre+ command To +er"orm a ca!e-in!en!iti#e !earch -ith the gre+ command, ju!t add the -i o+tion, li1e thi!: gre+ -i !core gett$!burg-addre!!&t7t Thi! gre+ !earch e7am+le matche! the !tring ;!core;, -hether it i! u++erca!e, lo-erca!e, or an$ mi7 o" the t-o& 46 3e#er!ing the meaning o" a gre+ !earch 0ou can re#er!e the meaning o" a Binu7 gre+ !earch -ith the -# o+tion& 8or in!tance, to !ho- all the line! o" m$ AetcA+a!!-d "ile that don>t contain the !tring "red, I>d i!!ue thi! gre+ command: gre+ -# "red AetcA+a!!-d <6 U!ing gre+ in a Uni7ABinu7 command +i+eline The gre+ command i! o"ten u!ed in a Uni7ABinu7 +i+eline& 8or in!tance, to !ho- all the +ache htt+d +roce!!e! running on m$ Binu7 !$!tem, I can u!e the gre+ command in a +i+eline -ith the >+!> command: +! au7--- M gre+ htt+d !) -.plain /ni< )ommand. n!: The de"ault out+ut i! to di!+la$ line! that onl$ a++ear once and one co+$ o" line! that a++ear more than once& It i! al!o u!e"ul to "ilter out multi+le blan1 line! "rom un!orted out+ut o" other command!& 8or e7am+le, the dircm+ command di!+la$! it! out+ut u!ing +rI thu! the out+ut u!uall$ !croll! o"" $our !creen be"ore $ou can read it& But i" $ou +i+e the out+ut o" the dircm+ command through the uni2 command, the blan1 line! are reduced and the out+ut i! more com+act& -u Print onl$ line! -hich are not re+eated 5uni2ue6 in the original "ile -d 9on>t out+ut line! that are not re+eated in the in+ut& -c Fenerate an out+ut re+ort in de"ault !t$le e7ce+t that each line i! +receded b$ a count o" the number o" time! it occurred& I" thi! o+tion i! !+eci"ied, the -u and -d o+tion! are ignored i" either or both are al!o +re!ent& -i Ignore ca!e di""erence! -hen com+aring line! -" Ignore a number o" "ield! in a line -! S1i+! a number o" character! in a line -- S+eci"ie! the number o" character! to com+are in line!, a"ter an$ character! and "ield! ha#e been !1i++ed --hel+ 9i!+la$! a hel+ me!!age --#er!ion 9i!+la$! #er!ion number on !tdout and e7it!& 3. a) -.plain the me)hanism of e.e)uting =o! periodi)ally using )ron. n!: ta!1 can be automaticall$ run in the bac1ground at regular inter#al! b$ a Uni7 utilit$ called cron& The cron daemon ta1e! care o" running the!e bac1ground job!, -hich are called cron job!& crontab or the crontable i! a "ile -hich contain! the !chedule o" cron entrie! to be run and at !+eci"ied time!& cron chec1! the crontable at regular table! to !ee i" there are an$ job! !cheduled& u!er can e7ecute crontab i" the u!er ! name a++ear! in the "ile Au!rAlibAcronAcron&allo-& I" the cron&allo- doe! not e7i!t, the cron&den$ "ile in Au!rAlibAcron i! chec1ed& I" the u!er ! name i! not in thi! "ile the u!er i! allo-ed to u!e crontab& I" onl$ cron&den$ e7i!t! and i! em+t$, all u!er! can u!e crontab& I" neither "ile e7i!t!, onl$ the root u!er can u!e crontab& Thi! allo-! and den$ "ile! contain one u!er name +er line& !) Write a shell s)ript to add t(o num!ers !y using -.pr utility. n!: To u!e it in a !hell !cri+t, $ou !im+l$ !urround the e7+re!!ion -ith bac12uote!& 8or e7am+le, let ! -rite a !im+le !cri+t called add that add! t-o number! t$+ed a! argument!: C AbinA!h C Shell Scri+t to dd t-o number! !umWJe7+r E' [ E(J echo E!um @ere -e de"ined a #ariable !um to hold the re!ult o" the o+eration& 5Note the !+ace! around the +lu! !ign, but not around the e2ual! !ign6& To run thi! !cri+t, -e might t$+e the "ollo-ing line: 5a!!ume the !cri+t add i! e7ecutable6 E add 4 3 The "ir!t argument 546 i! !tored in E', and the !econd 536 i! !tored in E(& The e7+r utilit$ then add! the!e 2uantitie! and !tore! the re!ult in !um& 8inall$, the content! o" !um are echoed on the !creen: D E The e7+r command onl$ -or1! on integer! 5i&e&, -hole number!6& It can +er"orm addition 5[6, !ubtraction 5-6, multi+lication 5N6, integer di#i!ion 5A6, and integer remainder 5\6& 5. a) What are positional parameters& -.plain the )ommand used to set the positional parameters. n!: The!e are u!ed b$ the !hell to !tore the #alue! o" command-line argument!& The command -hich u!ed to !et the +o!itional +arameter C?AbinA!h C 9emon!trate the !et command !et JdateJ echo KTime: E4 E<L echo K9a$: E'L echo K9ate: E3 E( E=L !!uming that !etdate ha! been made e7ecutable -ith the chmod command, -e can run the !cri+t b$ t$+ing the command E !etdate The out+ut -ill loo1 !omething li1e thi!: Time:'):<=:)* .ST 9a$: 8ri 9ate: () ug ())4 :hat ha++enedP Con!ider the command line !et JdateJ The bac12uote! run the date command, -hich +roduce! out+ut !omething li1e thi!: 8ri ug () '):<=:)* .ST ())4 Thi! doe! not a++ear on the !creen& In!tead, the !et command catche! the out+ut and !tore! it in the +o!itional +arameter! E' through E=: E' contain! 8ri E( Contain! ug E3 contain! () E4 contain! '):<=:)* E< contain! .ST E= contain! ())4 !) -.plain 4ead Command (ith e.ample. n!: The head command, a! the name im+lie!, di!+la$! the to+ o" the "ile& :hen u!ed -ithout an o+tion, it di!+la$! the "ir!t ten line! o" the "ile& 0ou can u!e the Rn o+tion to di!+la$ the "ir!t Jn number o" line!& E head em+&l!t Sho-! "ir!t ten line! o" the em+&l!t "ile The head command, a! the name im+lie!, di!+la$! the to+ o" the "ile& :hen u!ed -ithout an o+tion, it di!+la$! the "ir!t ten line! o" the "ile& 0ou can u!e the Rn o+tion to di!+la$ the "ir!t Jn number o" line!& E head em+&l!t Sho-! "ir!t ten line! o" the em+&l!t "ile '))'MT&N&3aju MPro"e!!or MIn"ormation ScienceM'4A)=A='M3)))) '))4M9&S&3aghu MBecturer MIn"ormation ScienceM)<A'(AD<M'D))) '))<MS&Q&nantha M!!t&Pro"& MIn"ormation ScienceM()A)DA=3M(4))) '))GM4&P&3ajendra MSr&Becturer MCom+uter Science M'3A)3A==M()))) '))(M4allu MBecturer MIn"ormation ScienceM()A)DAD4M'<))) 7. -.plain the options and asso)iated a)tions for ls )ommand. n!: The I! command !ho-! the content! o" a director$ , and a #ie- o" ba!ic in"ormation 5li1e !i/e ,o-ner!hi+, and acce!! +ermi!!ion6 about "ile! and directorie!& The o+tion! and a!!ociated action! "or I! command are: %PTI%N CTI%N -' %ne "ile name in each line -a ll "ile! including tho!e beginning -ith a dot5&6, current director$ 5&6 and director$ abo#e 5&&6 - ll "ile! including tho!e beginning -ith a dot5&6&doe! not li!t current director$5&6 and director$ abo#e& -d I" an argument i! a director$ ,li!t! onl$ it! name 5not it! content!6 -8 4ar1! directorie! -ith a A,e7ecutable! -ith a N and !$mbolic lin1! -ith a ] -I Sho-! the inode number -l Bi!t! in long "ormat , gi#ing mode, number o" lin1!, o-ner, grou+, !i/e in b$te!, the time that each "ile -a! la!t modi"ied& -+ Put! a !la!h 5A6 a"ter each director$& -r Sort! the "ilename! in the re#er!e order -3 3ecur!i#e li!t -t Sort! b$ time modi"ied 5late!t "ir!t6 -u Sort! b$ la!t acce!! time