You are on page 1of 109
“BASH ( Boune again Shell) is a Linux Defaults Structure: 5.1 File Operations ~ 52 SHELLS 53 BASIC COMMANDS 5-4 GENERAL PURPOSE Utilities 5.5 Installing Software 5.6. User Management a7 Environment Variables 5.8 Command Aliases tail : raj mail 1 -f, -n, and myf we date 0 clear 0 Let’s take rm command, which is used to remove files: 2 a Sim {filename} : Here rm is command and filename is file which you would like to remove. This way you tail m command which file you would like to remove. So we are doing one way communication with our command by specifying filenan: “pass commant line arguments to your script to make it more users friendly. But how we a: line argument in our script. Lets take Is command $is-a/* = 2 This command has 2 command line argument -a and /* is another. For shell script, ‘$ myshell foo bar 7 eee ve file - oo \ used to remo is file which you would like to remove. ‘ch file you would like to remove. command by specifying filenan, inication with our it more users friendly. But how we a: ne arguinent -a and /* is another. For shell script, _ sag es 3 comma cond coma nt £ we wish torefertis shell iis $0 oitis $1 itis de. oo ATET. A le of shell seript cs 7 7 ash me from: its stipt Name; "$0" : otal Number of Argument Passed: “$4” sguments List - Stee ~~ 2 ee os 3. $3 All Arguments are: "$*” i smyScritsh 50 kiraneroem agony ites conan wg t Names mySertsh : Hoe feel | Number of Argument Passed: 3 ~ mn uments List - ‘ van ~~ som 7S a =— Arguments are 50 kiran ks.com | "ue auaneaneTeuSUSTETSGuETeREIEETSTSESEEREWES== = —o| /10 write following for commands ll Script Name ($0), oF Arguments(.e.$H), ee i actual angurnent (i.e. 81,82ete) = fi Se yum 11 20 : math 4-7 é bp-$ myf +20 7 Lt ge ai +0: caged: cal _— HH findBS 4 8 24 BIG 424 Shell Script name ie. Myshel First commandline arfMhent passed to myshell ie, 00 ‘Second command line argument passed to myshell ierbar = = if we wigh to refer this command line argumert we refer above 2s follows myshell itis $0 foo itis $1 baritisSte. — et, Script Name: “$0” Total Number of Argument Passed: “S#” hell Seript Name (S0), jo. of Arguments(..8)"~ _. id actual argument (ie. $1$2etc) - sum 11 20 math 4-7 4 bp -5 myf +20 Ls* ~~ 7 . cal : findBS 4 8 24 BIG ; a i aiiaineannernnernrrerrer eee eee eee a The CNU/Linux shell is a special interactive utility. » program started after you log on to the LINUX. hi : it provides a command line interface or shell between user 8 LINUX ker fundamental interface to O.S “Kernel”, Se 2 The core of the shell is the command prompt. The command prompt is the interactive part of the shell Typed ‘emds are interpreted by the shell & send to the kernel which in tums ope, writes fil / The shell runs like any other prograin wider the LINUX system. | © A shell is simply a macro processor that executes commands that you enter t prompt. 2 A Linux shell is understood to be both a command interpreter and a programming iany. You can enter the commands at the command prompt (#) and the shell will run then, 2 Ifyou have several commands that you need to run, 3'2"1 can put them in a special ens script file and the shell will run it also. CD There are quite a few Linux shells available to use on a Linux system, 1D Different shells have different characteristics, some being more useful for creatiz some being more useful for managing processes. ~The default shell used in all Linux distributions is the bash shell. The besh shell was developed by the GNU project as a replacement for the sia“! called the Bourne shell (after its creator). ~ LINUX SHELLS: There are no. of shells available for linux: OD Bourne shell O Cshelt O Korn shell i Q Restricted shel! Bash shell (Bourne again shell) Q Tesh shell ee O Zstell _~ a 2 POKSH sel (bt domain kon, Bourne shell: i oa 2 tis fastest unix commen, : —~ ; id rocesso © Wismost widely ued sa ee ‘lat & itis availabe on ll the unix ss, Present for sys, iss & iti i *insalled a /binih Iti developed by ATAT, = Cshells ~ 2 This is another” ang veloped mn Processor Wittens ¢ fm is propening ngage eveloped by Willian’ joy’ it gets it's name from its >This C shell isnot compatible 2 The C shell was developed t , tmguge. oon Ped to provide’ a Programming interface similar to C programming 2 Thename oF exggutable file is esh, => Korn shell or ksh shell; a ‘2 Itwas developed by David kom. Itis also 8 product of AT&T. > Itcontains the best feature of both the above shell ie. C shel & Bourne shell 3 The executable file name is ksh, The executable fipamej ‘With bourne shell 3 This is a Bubliewt@iain istibution for Red Hat ata. > ‘The korn shelltthguage is an intetactive, completeshigttlevetrogramming language that can bbe used to write shell scripts and programs. {tis useful for writing applications with the development time beng less than most oth programming languages. 2 e Ksh-isieglled conguaa line completion that means when you are typing a command at the commandline’ Will attempt to guess what yolfafe typin 2 A programming’hell competh!s with the Bourn Well Eur supporting advanced pro features like associative arrays and floating-point arithmetic : Restricted shell: > When you want use of O.S. to have limited access to LINUX: ae torrestricted sel is vst . ‘Tis typiogl ying wc wo et pala insurance instalation whet ° mete gid to work gly in heir own i ate 2. These are called rah shells. Sh shell: 2 Bash is known as Bourne again shel: > itten by Stephen Bourne, __ is 2 ime yy sjsBoume, el since otehe she Ay default. shll of Unix hich is isan ig WGUFRERVEOf Unix, ; already registered hence Linux Q. TT ie pens ee ised bourne again shell, js Linux system. 2 inagetut sel oboe 7m 2 The Basitthell wie ee > ‘The Z shell can be executed by zsh. ‘D> Ithasibest features of Tesh set shell, 2 Iralso has features of kon shellé having large no. of | ulilities & extensive dou Itis designed for interactive use with a powerful scripting language. ‘An advanced shell that incorporates features from bash, tosh, and kom, pron: = ; vin Jow-memory environments aN oA simpletest sll that 1 vil ‘5 et stands tr Tom's shel, Also known & Te shell. 3 iisenancement of C shell. > Thesymbolic link available for Tesh shell on Linux is csh. 23> Yow canexcoute Tesh shel typing either est or tsb. D> The Teshell are not compatible with bourne shell | A shell 1A sll hat incorporates elements from the C programming language ina, The A shell (ash) was developed by“ “Kenneth alnquist”. 4 27“ Ttve lightweight bourne shell. i 5 eisusualy suitable for computers that have very limited memory. | D> This isa light weight Bourne compatible shell. | Z shel: programming features, shared history files, and themed prompts. fears jé BASIC COMMANDS of Linux Sogeeneni x ‘clear This command clears all the ch oad luter on tae terminal and gives you a clean window to we" wh: Nera ie aa aaa The Widen gebs clear? gine — eo 125 4.0" ints the ll pathnagae ofthe BP = Curent Work ne cml We Vg ng directory, 'S YOU ate ir vm . fod ut te bse painame of our Fame, in reaon The whole file-ygeg, For exami (0 pf HEMP Chreotry, tye ef to ge back to trem ct apnd ‘PovebengleDlab. = 7 | te conte ofthe evan yyible PUD govt sone namo na | = | gos" or" component, then on fal back to default -P handling put thos contents, even ifthe contin symlinks : Pri filly resolved name forthe eurent rectory names, and not symbolic ins) dzetry in which al components ofthe nae area pion | Diplayveion infor nd ay : : ~ 2 ae! Options pod syntax z peda pwd (OPTION) cae il az {pwd [OF pwd examples a a a 3. gat with>-<>> options << xcTising cat to erente a ies catisalso useful for ating a ile a 1 Ber the commard gat llowed bythe > he rig ceion). charac the flenamefor & non Ay —e Seat> kiran ‘A> symbol following the command means hat he sed inthis way represents a rudimentary eda" output goes tothe filename following TE. cat (Ctrl-a)"~ - aed S _prompirettrns => am O Scatafilels create anew fleknown sie. This command is used 10 dicate end of file mark ig 2of mark. = “To sve this file ctl #4 option ius To imrrupt in berwesn ot #2188. defies that rediet the crt OG newly This comand fem, ote snk in . ——— a i pret vais, a a ite to take a Tr ct i yw ae oinps we OF ri th eo hace sed by UNDE apts ands svn ow OE tr fre expat willbe mae, * ' When hi char Zoe msn —- ¥ ene hu ograw Pqns poyPd9. OF POM 51° PUD swpyar Ip Bunjiom yuasa1d mok ur Auoyompqns e ay8—19 | —— ip 218219 ‘fpeasye 1x $2120} dua py § fo. ‘Asoypautp awoy ox opun daz palfeo AuoWoasIp & soqeax SU Te + spueurutoa yonoy amp asn ‘oiy Arduio we Sunvasd yoy vo I> E6LPC6] 199i $€:60 1 dag Q you yo Paco 179 2 PML? pose yn anys ao? Pag er PH? ef? :21y Ardtwo uv ayeauo fjiseo on puewuios yoror j. 1% ‘Suonengis asaxp uy] 0} aqLuM ued Koyy a40j9q yUasa1d aq 0} 2] Bo] z y0adxa suoNedt|dde “W Aaduta ue ayeaso 0} poou nof aoysh tonETals B Oyu UTA JK NOx 314} B 8y89I9 0} puvLUUOD Yano} 3 = uN ‘ery o1y Jo swuajuod ayy yoarIpa7 0} posM S| PUBWIUIOD sty, Pm wo aig portsads jo syuaiuod Andsip 03 pam st puss s Ho} vawp powwau Apeags —- 1 ayB020 [|W 11 Wolf 3819} poywexo JOU sf aAoU JI “AOU a4 OYU popuadde ——~ U1 ojut (Bumppe) Buypuadde Joy syuayuoo osayp yoonpex pue indino I JO squayuoo oy} JOSMPA 0} POSN S| PUBLUWOD SI] :M9U << OEY IIS O Md ous ape usjeouca purwuioo ojavsiaa v S189) paumyar vduoad a4 pur uon ts st 91 UL, mand [you want to create a directory in a dierent joing commana location other than ‘Home directory’, you could use the mkdir ~—— — wl fe oul 7) oN ee nk mp/MUSIC will create a directory ‘Music! under Soca ey aT Tres es (ees (eer io q Tie woe ce! i Soe eae Nee aU Totaes Acai and od The ed command, which stends for "chance decir", changes the shell’ current working directory ‘The ed command is one‘ the commands you wil wa-the most at the command ine in ‘Jow’s you to change your working directory. You use ito ‘move around within the hierarchy of your file system “The command ed dicectory means chenge the sunsit working “i ‘The current working dietory maybe thought of she dietary you ain yur cunt poston nshe Session we [cicoangeaitosing ei ux. It ed (change directory) «4 a To change fo the directory you have just made, Spt ier fod unixsutt ‘Type Isto ee the contents (which should be empty) The directories . and. Scull in the uniastutt ditestory, DPS _ fect fsa ‘As you can see, in the tatu dtry (din al oer eres) thee re two special y , irecories called () and +) ImLINUX, (means the cretion $9 IPS . We, oie TOS mig OO Note. ther apactvewenn canoe GH i means stay where you ae (the unbsstust dicecion): ia ae a ah es ise) m8 EE SAREE : f awe later jn the tutorial ‘of typing, as we shall see (.) means the pare OT — a ad ye niente {ack 10 your home directory), . sauna directors ep EE ee you to your home direct agua tay FUT lu 7" Note: ping el Hl argu 4 somare estan te HE system | ‘muse the '’ command, yO wit see the Jistof files on You Linw . yur current directory: «directories it ¥° Noe TTF re dented in lu clot jenoted in white, vai eon sees in rent favors of Lins only In directories b eo O Files are dk O You will fi Yow ean ue -Riashows all the files —Ss-R Gere ie ea acs desktop,’ Mery —— a ‘ sl renee Ba Ate 7 Bein Brite —_—— a 7 mien Listing Hidden Files =~ Hidden items in Lim in Linux begin wit ” Peri in wil ~"+" Period symbol at the sat, ofthe file ie ~_Any Directory/file igh Bone suring th. ft be sen ys you request or it 7 — ww *. $ rs creer Td ee eon | [ by Nov | Owner group | Other Stein | Date & time last | file narne permission | o - ee iaad links eee ae — 2 [reirnother 5 [+ [6604096 | 2007-08-24 15:34 | abedoe-| [-Tesarvarva [73 [es = fias0 = pe avonwarwx |_| _| kiran other [950 * we The file type (such as directory (d), Ordinary file -), charagter device (c), or block device (b) Sera the file: « 7 : me a Read With this permission user can readthe data or file, user can not write into it eH 2 Write With this permission user can write the data or file Execute With this permission user can execute the application. “The number of hard links to the fle (Links ofthe file in same directory) wt ‘The usemame,of the owner of the fil. ee ae ‘The group name of the group the fitetbelongs t ‘The size of the file in bytes. ~ ee The time the file was modified last. ‘The file or directory namePart I. The Linus is divided into 3 groups owner, group and others, < J —-Grmer: nis the user who creates particular MEM edaas.guner of hat file, The owner is @ petson who has all rights on the Files eregied By Win and also desides The-rghts of ther. pser ‘ciated to that file. The Owner groups abbrivated as y"_ : Group; In a typical sotvare ‘development one large project is divided among different members ofa term, So software developers requires that file belonging their project should riot accessible fo + _biher users hence thy wil aply Fight to group utes. tis abbreviated asig. Others: wil the”paersathat are neither owner nof eMbaggdatgavith a group is called ag other normally guest user Abbrivated Taso eee ed 7 eo ’ 7 ' Copying files and directories ftom-one location inthe filesystem to another is acorunon - - ~ practice for system administrators. The ep command provides this feature r In it's mgt basigeform, the cp command uses aja. parameters: the source object and the destination aBject | = oo » 7 - orga ®™ ~ a 10 ae! destination i source iteto aw file withthe Glenaine specie asthe destination. The new file act jig, | seat le, ith anupsted le ton dnd itd ines “ . wn mor rich rich 0 Dec 25 2008 kiran rich rich 0 Sep 1 09:39 newfile "1 1954793, 1954794 -tw. s De new. fileney tely new file, a different inede numbé le fi hows the tmethaitves Creag difiention timg for th command copies a file or a group of files. It creates an exact image of the fi, 2. The syntax requires at least two filenames to be, specified in the command line. 3m Wher oth regina es te fst cop tothe second: me _ file(unit)doesn’t exist, it will fist be creatod before copying takes piace, ply be overwritten without any, warning {rom the system, ly one file to be copied, the destriation can be either. an ordinary or directory. JeeYouthen have the option of choosing youndestinaton filename, we 8° The following Stariple SHOWs tivo ways of copying a file to the progs, Jas digeotory }# cp sourcefilename destinationfile ~ FBA\é ep /home/kir copy abe.txt from rectory to current FBA Directory e Jt.cp sk.txt /home/kiran/sk.txt cm EBA current dreetory tx an D Ditéoteny” wet | FBA|# cp /home/kiran/abe.txt /homedehiag/abe.txt eld it will copy abe.tet from kiran directory to chirag Directory ye In the Linux world, renaming files is called moving. The mv command is available to move Ca files and directories to another location: = Trav fest Te om ree ee | __ Sis-iltest* — oo 1954793 4 2rich rich 6 Sep 1 09:51 testi 4 1954888 -+ ich rich 0 Dec 25 2008 test3 1954793 - ich 6 Sep 1 09:51 testa 1354891 rarer’ ich ich $ Sep 09:56 teto"testl |. ae 1954794 -rw-tes 1 09:39 test6 wT e 3 eerraneae pnd IO that moving the file nice hanged the filename but kept the samme inode number and the N value. Moving a file : mesiamp value 8 file with soft I sm testt togs inks is a problem: — ~_ gis-il test - : i rotal 16 : ee ee eter =a wpsasgs «wert Ich rich © Deo 25 2008 tet3 1954793 rue 2rich rich 6 Sep 1 09:81 test : 1954891 inyxrwarwe Lich rich $ Sep 1 09:56 test5 > test 1954704 Woke: OSep 1 09:39 tests = 1954793 erwereet-=2 rich rich 6 Sef™I"09:51 tog. oe a ———~ tr aiines _ jch@rest2 clsc]$ my test8 test ~~" " a ‘The test 7 However, file that uses @ hard link still uses the same inode number, which is perfectly fine. bes the testS file now points to an invalid file, and itis no longer a valid link. You ean algo use the my command to move directories: sv dir2 ding Alm ~_ 1 The mv command renames (mV) les, Uh SOUT functions Itrenames a file (or directory) 7 - A itmoves a group of files to. different directory. ifthe destination doesn’t exist it will be create filename in the going directory entry with the nswenAlFe Like op, a groupof Bile8 can beamoved to 2 ictagy_ Te totem g.commang moves three files to theprogsditectory: = De TO soe nena oe my chap)! chap02 chap03 progs . i option available with my als, and behaves exaly like in op. : 4 For the above example, my simply replaces the There's mv filename newfilename ‘STRAT TERT a ag a E Pie Ore enc ate Paine erin , The rm command gameves (deletes) ies or director Fas ; rm removes” acts petted “er By defaul, itdoes.1ot remove dieses; °°, Refiéving Directories below for. details. te See pron proses unk # Sieame in ¢ SIE that space as useble by future writes: 1a ‘other words, removing on your disk. : ‘The data itself is qptadestroyed, but after being unlijfadnt becomes inaccessible. Remove your files : se cee Wisely! The effooi? of an.rm operation gaaipot be Undone wes Note: If what you want is) foscompl qintecorenby ale he dattrorrthe disk, ie" thePhced command instead. This will overwrite the ee eontents so tha they cannot be reeansi aed tee ay means, : : NY Fem data on the storage device, and. marks file increases the amount of avilabg space ex removing a hrarchy recursively, tip any ditctory that ison a file system da 4 i TF thesileisewniee protectedsyou will be promptéd to contin 0 dele it -_—— —_”~* Removes a directory. TEE Padi Dery cemevesnie ig caty BHT pecifed bY Eict. directory Hegument, provide! roceary 1s empry =. é Anguments are’processed in the order given. To remove both a parent directory and a subdirest0™ 7 paext, the subdirectory must be specified first so the parent directory is empty when rmdir mnowit ” gzce Taam Rules arto be Followed for Removing Directory, : = 1 Diteeeiry shoul Emp 2 2. "You should be out ofthat Directory. oe a “33, rmdir syntax ee rmdir [-p] directory ym ir Pl eee Td a - 9] rc aore-alron non-empty | ignore any fire whetTbwus ily bibs adieson non. =| all eomposents willbe | Seem orbly “| Etch decor arguments wened a a pathname of whic removed, ifthe are empy, stating withthe lta component pgq-diseiminant recursive removal) very Drectory processed asa [Display verbose information Display apelamessage, andeexit— Output version kiformation, and exit oe rmdir examples | mdir mydir = Removes the ayectory mydir. Ze = ae . : pg ee pawan : Man stands for manual which isa reference book of @ Linux operating system. Its s found in popular softwares. ‘To get help.on any command that you do not understand, you can YP san a Sa ‘he terminal would open themanudlPage for thas Go: _—_— vee ibe an Hawrane-hieiter WiRinal would give ws Tfermation oF Man imilar to HELP fil For an example,” command, ere mrss Earetke eee een coca — Pere ass Oe ete cca ML a Peet eT ae ere cle ca ua PAM eee ee cae ae a reicaica meena RE OO) teri feed Prt ee uments Pere) er ee es iei3) eee oe aC) a 4 t Ea pid nea erect ee eta aa) Sime Je fexldpiy] ' 71-HMe ee Peperitsact eee c baronies ORT Tm er A) (ieee page nan(1) UW Toouom of ee ve aT are lead ight tt oF SENONEM Fa yf Je the conten this. ove at ammand is used t0 acl : ecwige stated.” rane the fis te lines ofa, unless otherwife pee ei eae ~— Syntee—— 1 iti von - <7 (namic sate ee a ret of pervssions and ownership i ruabiLin Name cern” Pet the OwmersIp. pis, crucighinsbinux-.. Heté> we-willadiscuas both of them 2 ynership in Linux files Frey ile and directory in your UniuLinux ystems asigned 3 pes of owner given a ver i aris the ower ofthe BIENBy def, the psn matte tc is ner. Hee 2 se was sometimes ealled an‘owner, te reno serene ? i z Auger group.can contain multiple users. All users Belonging to.a'group will have the.same access 7 senso tthe fle, Suppose You have a project where a ‘numbet' of people require access to 2 file ised of nn to each user, you gayd add all users to a group, and assign pup permission to file sy ‘that Shly this gugup membersangno, -elsecdn-rezd.ormodity the files. Other ae mg emma Tere Any other user who has access to a file. ‘This person bas neither created the file nor ‘he belongs.to a— wagroup who could own the file, Practically, it means ‘everybody else. Hence, when you set the - temsin for others, itis also referred asset permissions for world. Now, the big question grises how does Linux distingul ween these three user types. so that ~ ‘A’ cannot affeora filefwhicHeontains gqyne other us (vital informationddatalt is ike you do not wa your colleague, Who ‘works on: your, Linus, ‘computed yourpersonalmage-Thisis-wnere Temioa set in and they defineuser behavior. ~~ Letus understand the Permission system on Linux. Permissions : on Erery file and directory ing/our LUNDX/Linwe system has faligwine 3 permissions defined for all the 3 rs discussed abe 2 Sam. a“ a Q Read: This Fegission give you the authori diectory gives you the ability 3 ist if’ coment, ; Write: The right permission gives you the vatboriy to modify the conten of «file, The write picts as ae autor 0a eOvE and rengyne files stored in the mn ch nipalt 7 ere you have write passion he file but do not have write penne et Guess were Bl 8 sori gibeme acai oS 7 you will Not be able renames Ove SE fal phn ee ene” and whieh oe bs y exe" a you-can- sasiy peter an evcaine TT program unless the execute permission. js set. Ifthe xe aence i ra ef, you might stil be able € ‘seelmodify the program code(provided ~ "ead & yt permisgjags are st, Bu not actual) wri permis eigen =. —_—- at ee _ RTE ESAS ATR EOIE EEE Kans sassagoad au [ye 409"? Od : Zuuttag PN padwjdsip vonr PCHIVHUD asn am uayar suru S¥°P! : I “stabi ss9d02g, of spunys pusuTUICS STL. puwutuo? 9 ~ © xpd xa-k PO! jou a8 pou ~« rapdwoxd xo utS al wv ses ‘opns ¥W”00:00:00 od — 9976 qo ow ALL a - : wed y _ it \ 2 1S RPE 000000 6 ot ~ sow noni pron a 6 s - varmane7 o0i0000 ko powrrna: 900000 LL oonayony 000000 LS ogiovo0 kt ~ : a ovogoo Lt ae puastiy, “e000 4 I aw aWIL = ALL id aa be fd. ogt00:00 ead _ ae . sg onto0'00 tm ic ’ a . opr 060100 z/sid qwo | UWL ALL DATE Command is command igused yf ny todays Syst y month or only year Or week: Kid acumen ate ~# date - i Sun Jan 8 05:57:54 PST 2017 ~# date +%a Sun ~ 7 ~ Hdates%b Sm ne L ae me tied —_—_ Jan = os , = sat ~# date +%c Sun 08 Jan 2017 05:59:58 AM PST ~# date +d ~ 2 _ - orm — =o ——=” - pat aroP ‘sd WW 85:65:50 row wr 80 MS 3 BBD a : : : ee | 8 . " : _ 7 ~ ~ey a cee al =F * : Die ioe asa vsizs'so 8 um Uns a ca 10 seek fu — aa = saoaustr0 gepen : - Es somunar so Regain gr POTS puBurod sit os — “puvustod BL = ae uso} joogar auunpeysaup warek ee 0 diag MT0- o.-.0 0800 wor oT Oa ele _ ML ALLS NVHOM ZS MAC IN do dda ld a _— ed : = a ee SS ~f date +%6D . - 01/7 - visti abet —~ waste oF” Oe - — \ a ATTEN 1S me ~ fe Hdate +4G 2017 Haat siN Ve\ \ : a . : _ date +62 : i bE ann aoe * 2 ; C —_ 7 ——ty 7 2. cal commalt — Cc Command is used to di alndar by det fr all yea It has sth-calendar or specified month and year calendar. ly Seal . ; =F Oupus 7 - 7 ot - So TT em Se 1 3 4 -$.6 7 89 2 MWS 16 I A 9 wo m mms See ea] ETE nal command changes the opt format: Seal > a = - A Print calendar for year 2008 cal 2008 : Ouiput: 2008, — January Februy March We Th fsa [Su Mo Tu We Th» fm Se[ Ss Mo Tu We D Fr St! 7 as 12 . 0 wis «os 6 7 8 9f2 3 4 5 # 2 B wou wv | 0 non ws wis 1 2 ow a om ws «|i wm a mn ale 1 y wu 2 03 ws em ww [am 2 on we 2» ost ‘Apa May June. We Th Fr Sa | Su Mo Tu We Th Fr _Sa| So Mo Tu We Th Fr_ Ss aaa: ,o2o3fr 2 3 4 § 6 7 5 wn nls s 6 7 8 9 wie 9 W eo uM we 7 Bln a nw B woTlis w wm a) a uo wile oy mo 2 2 a ulm sm wom 30 aw nm 9 0 ui» w uy upst September We Th Fr Si [Su Mo Ty We Th Fr sa[Sv Mo Tv We: Fi S.| 7 12 123 4 5 6 s wu nis 4 5 6 ee) D 67 ww J noe 16 | wo % a mM sw {m7 2 nln n nm 2 a en ™ won wo | » 3% 3 aaber November December We Th Ss [Su Mo Ty We Te f& Si[su Mo Tu We'm FH Si 123 4 Hl 123 ¢ 5 6 Bee ee a boo is fs Won BB MS s 6m 2 nnusle 7 wo 0 2 milan nw % 7 2» 0" 31 BoM os 6m mw w/e w 0 HI 30 Print calendar for particular month and year Use syntax as follows: cal {month (1-12]} {year{1-9999]} For example, display Jan-2007 calendar, enter: Seal 1 2007 adwory [7 noa8 9-J[dnoas ousunng 2 orepAndxo o]ouoy p+] ppesion muy : coon oan noua ppesase \ ss}eyn ames . LSE oan 241, 0999 5 5 003 ste = oi 1 3 99g ony O14 os yenaman roomy one u-oysay ary 019 099: ‘ wis $8 gun ages ap pra gees nea apoyo sane ag Ane oy poms puruuc> oye, a4 gs Besa ep se aye aga fons ais Wi 0 posn 1 preuunoopg 1 pid nog sary o¥pe jn paul si Pru pre 7 fips : “weak yaumo 242 sepuayeae édsiq "7 He me “CUnjoo ypom owe nog aH xp sguup ug. = d-e95 a9 haere ‘ho poms youuu joo ky wog past st apoa amos au eou 2 Sema) unofe1p oy wey wo Sep unyoyims pue sapco dnunoo ayy yung Ti {anes aygeerea ' [ : , £ Ju 99Qmm gos au oygeueA a $ Sam ean edd s (Seqpingg xopoipic uessmy pure yp21p) -ysea xopoxp Jo ane (1 Azenuep woy passqumnu ‘paseq-auo step) “Gh or cdo se pana jo ap 29 Axpuoyy 04s 2 (Soyamyo ways so) 9500 -mpuaey "Jo ap dsp ‘uondo ay) nen pauguon jt Yepoyumyoy Ads THs UOUL xOU a4p pur YpUOW! wound a4) yuOYWsNOLAaHd ayy Wud op wow snowaud ap aig w/e oh ve 4050 80-10-L102 1009 warsis ou 1 céyept 966 £1390 80° 07L1O7 ca NIDO1 1 zoe yr90 BotoLIOZ§ MNIDOT s inept oot iso SO"OLIOZ ANNI | owm H/:rauMGA00, (0%) $0:50 80°10°L107 xn, ym y vv poo ave os sas 49 J tp 8 HYP On PST SE PLEO sy aI ZS 11 vee HL BEyOQE A 9m 4 | erage sz ae 2qu TMH pero ¢ { aayoqe omg } pa'oge 75 sxy9q0 WM vavage 7S pryaqua-omg pevoge Zs LE “oun @ 18 Ose sayy Jo soquinu Woy {[am se “> E ine jwinyy ‘sp40,%, JO 29qUN “S20Ur quan, ‘SP20q% JO JOqUIMN “Bur fo JaqUMN, MOD IIH NED pro; J0p pan st pURUIICD SE spurs Nndasn » passe’ suaasno 405 ydwoxd 104 INH st, PuORSHNd SND toxaD o1 pueurOD passed asm We somssed sie eT TH eect ego Pp plo ayn 39) Musoud jm SI4L “passed Butsn ayy ‘paomssed 24 au ao / | puburuios wos piomsse ssf pu rot? om 7 _ YW ee #who-q ~~ : linux, g usersel # who-T | linux + tty? 2017-01-08 05:05 (:0) | #who-a i ~~ system boot 2017-01-08 05:04 ! LOGIN 2017-01-08 05:041008 id=tty1 runlevel $ 2017-01-08 05:04 linux | i=tty2 || id=ty3 who-w linux, ty7 2017-01-08 05:05 02:08 1735 (0) < # who -H NAME LINE COMMENT Jinx a7 (0) #who-r Tun-level 5 2017-01-08 05:04 #who-m ps0 2016-12-061 6:19 (:0.0) S whoami ee Command If we want to extract one particular field from any file or from output of any command any | | can be extracted and displayed using the cut command. + “A single character can also be extracted by using ¢ option of cut command, Feat mast ABC:and:dog XYZ:and:cat ‘limiter or field separator. aa 's followed by the list of fields that have to be displayed —f2 i.e. 2nd field iS" Also cut command can take the input from other command, ‘$ cat mast |.cut 4 “:"-3 OR and Li scat mast | cut—d°" 6 qryou want to display eld 1 & 2 both scat mast | cut 2“ 1.2 ty you want to display fed fom 6 t09 scat mast | cut ~d* “16-9 ‘more than 2 § cat mast | cut -d“ “11,233 same as for char Scat mast | cut—d““—e5-7 7 If we want to display first 10 lines of ABC.xt file but only first field of that file Scat ABC.tat | head | cut-d“* ~fl p.sér Command ~~ sort command is used for Sorting data when wor'ing with large amounts of dats. BY command sorts te data lines in a text file using standard sorting ries Scat filel one wo three four five $ sort filel five four one three two s Example: Scat file? 7 ! , 7 ! 100 45 3 10 145 15 S sort file? 1 ' 10 cette 100 145 2 default, the sot Me $$ 3 48 18 : ir ical order, the sort command etng the numbers to sort in numerical order, command i vn od pe se sud character sort, producing output that might nog be a poble vse the -n parameter, which tells the sort ah t0 recognize r inead of characters, and to sort them based on their numerical values: S sort -n filed 1 0 45 100 145 ‘The sort Command Parameters: © fear leading tanks lqnor leading blanks when sorting, heck=quiet Dont son, but dont report if daa is out of sort order check Donft sort, but check if the input data is already sorted, Report if not sort Gleonary-order Consider only blanks and alphanumeric o!, characters, ‘gnore-case By defaul, sort orders Beneral-numericsort Use general [Biot ongrintng Ignore nonprntable characters in the sort ey=POS!|,POS2] Sort based on position POS!, and end at POS? ifspecifed. monhsct Sort by month re sng three charster month names. ‘etge Merge two steady sored data files, Tumeic-sor Sort by sing numerical value, uputile Write result ile specified, aracters dont capitalized letters fst. Tis parameter ignrs wumerical value to sort, wove Exe bullet-size=SIZE Specify the ‘Amount of memory to y Stable Disable lastresort comparison, : ascending, . e, s 1 temporary direction=DIR Specify location to store (temporary working Biles utp it the parameter, che for strict ordering; without the - pram Output ony the frst occurence of vo similar ines, z 2et0-terminated Sort Ptr with Options: The Gees eu Sort Filter with Options: cae nr pOD ge R- acne Output only the first occ z der, the sort command interpret that might not be what yey ut check if the input data is already sorted, Report if not sorted. ignoré-case By default, sort orders capitalized letters first. This parameter ignores case. general-numeric-sort Use general numerical value to sor. ignore-nonprinting Ignore nonprintable characters inthe sor. ‘ey-POS![,POS2] Sort based on postion POS1, and end at POS2 if specified. ‘month-sort Sort by month order using three-character month names, merge Merge two already sorted data files. nnumeric-sort Sort by string numerical value rite results to file specified, Sort by a random hash of keys. the sort order (descending instead of ‘ascending. | Specify the amount of memory to use, ‘ero-terminated End all lines with a NULL ch; waracter instead of L ine ‘The Sort filter arranges the input taken from the standard ‘input in the alphabetical order. The options available are: he Me to recognize numbers gr! Consider only blanks and alphanumeric characters dont consider so: commonine 1, Ssort listtxt: Displays the contents of file list.txt is Ascending order. 2. Ssort—r rie It Displays the contents of file isttxt in reverse is Ascending order. 3. Ssort-£ Alphabets and special characters that are taken in as input r= converted to thei ‘ASCII value. Like ASCII value of A-Z are less than that of a-z. . S sort case is ignored. |. § sort -n list.trt: Displays the file in ascending order of numbers 4 5. *posi -pos2 option: These options are used to exact te fields depending upon position defines $ cat name.txt ° firsmame middlename Jasmmame abe a xyz * b yal if the user: sorting on second field ie, On the middle name § sort +1 -2 name.txt OR 5 sort -k 2 name.tet (sorting on second ficld ) If Sort on Firstname then S sort +0 -1 name.txt OR sort -k 1 name.txt (sorting on second field ) 6, -toption: These default field separtor is blank space of tsb space. You ean check for the default field separator or any other special character S cat name.tit firstname: middlename:lastame abe: 8 WE yo: byl «the user want to do the sorting on third field ie. On the last name S sort-1 72" +2-3 name.txt 7. -u option: This option will remove duplicate lines from the input and display the outp-t. S catemp oor = X¥Z_——5000 002 «ABC 5300 003 © POR ~—<6000 e001 = XYZ 3000 2002 = ABC 5300 Ssort-t””-wemp e001 XYZ 5000 003 PQR 6000 e002 ABC 5300 - Zxdf ~~ searched, Pattern, is sent to the standard output Using s0r option yg to the file mentioned, Mi, S eat emp ABC XYZ PQR S sort+0b -1 emp I will sort correctly on firs field by removing or ignoring blank spaces.a You can use different options with —b option ination of -n and —r ie reverse order of numbers) ination of -f and -u) -nror-m -uf or ~fa (cor +4n-5 ‘number sorting but on specific field) wee +3nr-2 or +3m-2 (je reverse number sorting on specified field) ~ Examples 1, Sort the file on dept field and display the names of emplayees and their department. 3 catemp mtg : 5000 7 sales : 6000 se 42-Zemp|cut-d""-1,3 OR "-k 3 emp | cut-d""-22,3 ‘ep isa global search for regular expression from a file ‘These are filters, Parse and it is used to search particular pate Search the contents of files for pater, It wll print line in which it has got he ‘The grep filter takes two types of arguments ‘The First argument i the patter to be searched for ‘The Second argument is a list of file nam¢ search 8, Which are the files tb be ~S grep pattern filenamelist - ‘S grep ‘text fle’ preface intro Preface : A text in data file a, ‘The first ample searches the file filel for tent matching the pater tree. The grep coreranié sroiues the line that contains the matching patter, I eed to find the line numbers where the matching patiems are fount, use the - Smee : If you just need wo see a count of ow many lines contin the matching pater, use thet parameter S grep -ct filed 2 you need to specify more than one matching patter, use the parameter to speify each individ] S grep -e ‘two! -e four filed Examples: |. Write a command to display the lines in which the while petern mat files a S grep ‘while’ © used (ae OR Seat *c| grep ‘while? 2 Wc pete te ring Seo mul nse S grep “bot” emp.ixt ail grep “6! Admini Linux user 5.6 User Managene th other users by granting access privileges to they, the help of user accounts maintained by te system, an be used to create and manage User accounts ge ss a number of commands that ef

.ereation of a new user with this login. adduser -g Q 3 mA : I This constants system spesfic, defined in the file etcflogin def. 4 Q Removing users 2. Thecommand userdel is used to remove an existing user from a system. This can be invoked as follows: _—userdel -r Q This command modifies all ths svstem files, deleti The -r option will cause the user's home directory to be deleted along with any files or sb directories it may contai ‘Modifying user information < The command usermod is used to modify information about an existing user. ‘Managing groups The superuser can use a set of commands analogous to the ones used for user management. ‘groupaddgroupdelgroupmod These commands have functions similar to the corresponding ones used for user accounts. Again, every eroupisasigned a unique number called GID, ie, the Group ID. ing Users and Groups __ Bafore delving into user and group administration tc ; cap (PO) ioe shih mate Ln gaabene eae ‘The UPG scheme has the following salient characterises |. Each user hasa primary group with the same name asthe user account 2. Each use isthe only member of his primary group. formation about the specified user 153 | i ee : wults to 002 — [ : 2 puss — aes toed es Use every wer has hs own povate gr 1 the UPG 3 Hee 2 ores ore By the tonal Linux unaskof 02 is unneees0° a snes eID bition: dete have the set-GID (set group iD) bit enabled 4 Oey set the ts y then all traditional Linux files umask of 022 1° 19 Sry, srs ereated in that dretary have ther group st othe diecory’s eF0¥P ining User Accounts te can erste bY item Ado can be pled in arenetve ov + Jou might want le ue lect th oom parr, which wold no dou make them easier Fpremerbes ‘but which probably would be easier for a malefactor to crack. sox might want 10 ASSian passwords, which is more secure in theory but which increases the 3 petinood that users ‘will write them down on a conveniently located scrap of paper — 2 1K # ietiople ve aczs tthe area whee te machine) is ote frou wight decide that users must change their pesswords periodically and you can configure Red Yer cinux to prompt users todo s0, « rawhat may specific users Rave acces? I ight be thet thee are aspects of your business that Te World Wide Web aovess desirable, but you don't want everyone spending their working fours surfing the Web. If your system is at home, you may wish to limit your children's access t spewed, ‘which contains sites to which few, if any, parents would want their children exposed. _Aiser Creation, Modification and Deletion Taplin how system administrator can create, modify and delete user accounts. CAC wseradd Create new user login account Sta: vuseradd (-d home][-e expiry date}[-c comment][-g initial group][-G groupf...]] sat Example useradd —c “newuser” - 10/12/2015 erdel To delete user account fuserdel -r username Example: userdel -r terry serdel command fails to delete the account in case user is logged in 3. usermod 2 .g Maint To modify user account Sis, fhisermod [options] username ‘usermod —g abe —u 123 terry -lisets new user name “us unlocks account oie locks account and place ! In front of user's ing with Group Accounts: ‘ser accounts, group accounts always We acrypted password in etc/shadow ae represent some sort of logical organization of users. 184 a Like user accounts, groups have group identification numbers, or GIDS, and iti go, » te member of several groups. Groups are used to tie one or more users together to sm tasks =~ The group file sin LINUX ist rp. I has one ety pein and exh neh, le gtoupname : password : gid : userlist ‘gid is the numeric group LD number grouprame isthe name ofthe group atswordis an optional eld containing the encrypted group password ‘seri sa comma-separated list ofthe user account names that compose the group Group Account Administrative Commands COMMAND DESCRIPTION epasud Sets group passwords and modifies group accounts roupadd —Createsa new group account groupdel Deletes an existing group account groupmiog Modifies existing group accounts ‘Ex appears in the password field, nonmembers of the group cannot join it using the TOWED cin A spc entry inthe group file might esemble the fllowing: dmin:t:507-iran, ravi, chirag Broupnane is admins; passsord is empy, meaning no group password hasbeen segs yp = Mierlt is kiran, ravi chirag Creating Groups To create anew group, we the groupadd eommard, ts symtax i: froupadd - gid [| [+] [-]groupname _rouprame isthe only requed argument and must be the name of @ nonexistent group. Wisin ‘With only the name of the new group, growpadd creates the group and assigns it the fist unused GD ‘oth greater tan S00 and not already in us. Spciy to force groupadd to accept an xing gra Use the -g gid option i you want to specify the new group's GIN. ~~ Replacing gid witha unique GID (use the 0 option to force groupad to accept a nonunige GD) To create system group, one hatha pei privileges, use the - option, The following command creates a new group named adn _ #groupadd admin ‘Modifying and Deleting Groups srouphgd enables youto chang a group's GID or name and goassd enables you to stent 4 group's auhetcation and membership information, From roo’ perspective, gpassd syntax is + 7 Sisowd [A useroame] [-M username) groupoame Root can use ~A username to assign usemame as, “Musemane adds username to groupname's members rose, Assigning a group administrator wsing-A 1 oes not make the administer a member ofthe group; you have to use -M to ed te oi 4S. a member ofthe group, Mliple usernames canbe specfed with d and The filling command shows how to a8 mayen and ebb tthe ain up visi Vaca Broupname's group administrate. oy gut sagem aarysue; joebob ding ai administrators, gpaSSWG'D Symi: ae Hig + username) [-utername|groupname : : {environment Variables Porcge J (oot s intel is est ele event ates to aeration about the sh ne bas) environment (thus the name environment variables). ll ses8108 ine worn 0 ete also allows you to sore data in memory that can be easily accessed by any program gsi fro He shell. wat types of environment variables in the bash shell - “ere are 0 Global Variables. Local Variables. “gibal Environment Variables: Gita environment variables ae visible from the shell session, and any child processes that the shell sbles are only available in the shell that creates them. . - ns Local varia reas global environment variables useful in applications hat pavm child proceses that ree maton from the parent proces. referencing To duplay the value of an individual environment variable, use the echo command When sqenstenment variable, You must place dollar sig before the environment variable name: S echo SHOME Jhomelrich Global environment variables are also available to child session processes running under the current shell z Sbash Secho SHOME Jhomelrich Local Environmest Variables: = Local environment variables, as their name implies, ‘hey are defined. Set} example Setting Environment Variables: Patel You start a bash shell (or spawn & shell script), al ‘ble within your shell process. You can assign either a numeric or a string val the by assigning the variable toa value using the equal sign S test=testing S echo Stest ] Testing 7 Stest2 = test sh es: command not found nce you set a local environment variable, its available for ube anywhere within your‘shell process if you spawn another shell, it’s not available inthe child shel: Sash Secho Stest can be seen only in the local process in which you're allowed to create local variables that are ue te an environment of the test environment variable, made it globel : Sexit A 7 cenit 7 5 echo Stes te et ae et variable is not available in the child shell (it contains aban va Sir ifs lel envrnment varie in child proces, ene you eg the local environ” ont variable is no longer available: 4 Sas - Stes testing Secho Stes testin exit | unis S echo Stes Setting Global Enviroument Variables: Giotal en: ment variables ae visible fom any child proests created by the prc, sigbal envizonment variable. The method used to ereate a global environment variable is tore ~ environment variable, then export i to the global environment, This is done by using the export command: S echo Stest testing a long string Sexport test S bash Secho Stest testing a long string s After exporting the local environment variable test, I stated a new shell process and view This time, the environment variable kepi : value, asthe expat Removing Environment Variables: If you can create a new environment variable, it makes sense that you can also remove environment variable, This is done by using the unset commands ie Secho Stest testing = Sunset test S-echo Stest Pa a, Vote: When referencing the environment variable in tho unset command, remember net?" dir dollar sign. q If you're ina child process and unset a global environment variable, it only applies to theo 7 The global environment variable is stil available in the parent process Stesttesting y + S export test - S bash Scho Stest Environment Variables: s gut Shell Enviro the environment variables the bash shell provides that are comp atible with the origina! pe © variable tc —— “A colon-separated list of directories used as a search path for the ed command. The current user's home directory. “A ist of characters that separate fields used bythe shell vo split text SDE 7 aTH | . MAILPATH Ree ert list of multiple filenames for the current ‘user's mailbox. | {____+ the Pee cee eee ee “amiga a i im te a PATH A. ‘colon-separated list of directories where the shell ooks for commands. PS1 The prim ary ‘shell command line interface prompt string. [ps2 ‘The secondary shell command line: interface prompt string. MAIL The filename for’ the current user's ‘mailbox. The bash shell checks this file TPornew’ | bash shell checks each file in this hist for new mail. | mail. | “= OPTIND “The index value of the last option argument processed by the getopts ES {command Setting the PATH ‘Environment Variables: ‘The most important environment variable in this list is the PATH ‘environment variable. When you enter a command in the shell command line interface (CLD, the shell miist search the ‘ysem to find the program. The PATH vironment variable defines ithe directories it searches looking for ‘onmands, On my Linx system, the PATH environimst ‘arable looks like this: Secho SPATH : eat snenccashe usin Poin Ronee a is shows that there are six diretories where the sh for commands. Each directory in the 2ATHis separated by a colon. There's Rains &* the end of the PATH variable indicating the end of the ‘The individual directories listed estoy listing. : ced athout having to rebuild it for seratch. ronment varisle wthou TTS nto doi fern he ginal PATH value, and add 4 a ye PATHL fre separated by a colon. Ree to the string. looks something like this: Secho SPATH Just/kerberos/bin:/ust/lib/é eee cache nusehocalbinibinsitin home : "UMUNITW ® 0} Bundy moe UUTTICS WOLDS ayo gos) ‘spt 102 Wot HO} sweU sere we saxD oy nok ee {}2y 01 (sroyouresed puewwos y Ses purmmoy Susy. Saseliy PUBLIUIOD 31 ; asoidar ee : ley 101 941 SH Sup SON 18] puE LAD wo ssagp oe ‘play wwosayp soa. ut an : gowns o1p Aq 95 Sta] “Buton st wersks oup amp ouoz awn arp Siroods ayo = oF - > SNVNDO ‘Ss trewasH/ 515 saree 08 aps afueyp 0) aprsop plnoys Jesn ayy Jt a[gessyand aq plnom ajgeues apV YOOT LO 096 72#UEA TAVNOOT 9tp Ul souasayos afd wo fpoeatp awe Uo} sty Asn a OH ea 1] ‘wsecuu sures oxy axe yo Azoqax1p xogleu sy etp woUy Jos ap aide c ou uu wiBo] 24p spaou jon{ asm YoU Ut WoRAIS WEDD WI SYVNDO? os ais, TVNDOT sty Jo anes a se suyp any prom sup aur MBO] 2U: o auneapt ‘gurou yqed jou aureu wi8o] ayy SUD sploy axguUEA TY NOOTALL O 2 388 ENOL ‘aos In Saoraauip on P auey ped aynjosqe uy Asloods 0} paous sasn uayss pasn UIYO st a]Qrizts ZINOH oR Rr, ‘aye 5 NOH auy Jo syuayuoo ap sds puso ose a dure eu Igoe WOH atp ou peas fjlwauewoyne st pan ewoY a jo 2 ‘Pomrain s1 ymosoe ue uoyys Ksoysastp otuoy 2tp soUUaep JoWEASTU “Aaoypouip owioy ayy Jo SWeU ped aya sureuos 2yqeur wore fog sasqns Aue 029485008 S3}qurD UDURULALD sks ayy Aq pauyap axe ADU], “ZL Pu AAVNOOT “SNOH IPH Wouwios azz aioyy,ssojquizea yeoods pauruuaep worsts ape Sut ‘persis se anther name fOr a : a Command, Fo argument ix given, it shove we il ‘eurrent atin A108 ort names of commands, For ¢y9 : n sn Ample, you Might use the clear command! feaqiently at ges its *s covcleat” a ‘ce 5 ‘you enter ‘e" on command fing, yo ne sae Tine, your screen wil got clear Current aliases can he cTieekert ie a ictive aliases, Nias oc rose alist of ea ive aliases, use the alias command with the -p parameter alias -P jes-d sis] -color=tty" sis siasll* has s="1s olor aias vie'vim atias e=*clean” sjas whiche"alias | /usePbinwhich ~ty-only ~readalas~ sow-dot ~show-tilde? vee an alias to override the standard 1s command It automatically provides the suing thet the terminal supports color mode listings Using the alias command: {rich@testbox ~]S alias li="Is -il {Fch@testbox ~]S fi total 989292 360621 dewarwac-x 2 rich rich 4096 2007-08-24 22:04 4rich 301871 drwvar-xt-x 4 rich rich 4096 2007-09-18 08:38 Desktop 301875 drwxr-xr-x 2 rich rich 4096 2001-1 1-01 01:10 Documents 301872 drwasoxr-x 2 rich rch 4096 2001-11-01 04:06 Download (nee you define an alias value you cane itt any te in your shell, nchdng in shell series —— aliases act like local environment variables. They're only valid for the shell process in "re defined: Salias li='Is -il" Sash, Sti bash: li: command not found calor parameter Questions 7 | Explain Command line mode opdons in derail with exeemple a Explain what are different command Line arguments Explain What ig SHELL in Linux. What are diferent (yPes of SHELLS. « Explain at east 6 BASIC COMMANDS used in Lins S$. Explain ep, my, m, rmdir mkdir command with example 6. Explain Is command with its options Explain we command with its options. 8. Explain head and tail command with example, 9. Explain Gi NERAL PURPOSE Utilities of Linux 10, Explain wi General Options “ty —belp Print ep mesage and ext ™ Display vesion information and exit fle_| Use configuration file file rather than te default of ~manpath, “Ay debug | Prot deus ination, Dyas | Tsoi, when somal pee tx opt, roar | vir its deft suse oes tse option tat may ae beng SMANOPT. Aay option that follow -D will hae their usual eet | Enable wang fom he groff txt fate. This maybe ued o err Lage soqumu 2p 0s “uonses auo UeIY aJoW UL uonE}EoUNoOP axey Kew! spuEUIWOD wos T qu uonoas ut punoy wew Jo vorewoumaep ast wew ‘icwex9 04 ‘suonaas sou) Jo auo oy suas taquimu ayn sora ut oqumu ® £9 pawoy] aureu purmwoo ¥ 95 nox p “uoneuauinaop Supeas ay C) ‘SuOy}o0s Lew 2]qe|!8A2[[2 JO 1s 1 ButnoHo} 24 ‘soureu Sure ageyene Jo we i0j aed oj oad ayy sSuquzeys, 219 2969 esedas-Puloo® st s8urwiom “soBed UPL Jo 1a} auMOs a UO Sy2049 | ‘Wolse fensn tp anwy em = moqa weKp sUOHdO KEY -LEONVNS | Sh wang ay eur yg suo aso aa a BNE ch NON | Sa sas uondo saya e posed Aeon sf pamn wey ond « “woReanyy Boras wu | ep Bae oe et ta i edu jo ynajap am ony apes ay ay wonEMBganD as | yap ByNOD- pV D> "pe pue uopmUgyU, wows Feydsiq perm peng oti nt ( : {file = FILENAME specify - ; —e|J display this help and exit, | + -help a g2 0 ode pote by ier ay Ss ‘| cindex-search = ‘ 7 (i ~ are sae in it ite agg =a output selected nodes to Fy |e. -ouput= FILENAME _t capita” ANS et ag -R, ~raw-escapes output escapes 88 literal te, Lmo-raw-escapes ~to-raw-escapes__— em - Documentation UME eee LETT] ar oes Coen co rete Tee) ; anette} sudo adduser CC EN teres vi De Teh ht tae yLinux a PAS ue E Sas info reads documentation in the info format. {nfo is similar to man, with a more robust structure fr linking pages together. ‘A Info pages are made using the texinfo tools, and can ink with other pages, navigation in general create menus and ease The default location of info documentation is /ust/sharelnto, G Info documents are sometimes more elaborate than the man pages. But for some ‘commands, info pages are just the same as man pages These are like web pages. a Internal links are present within the info pages. These links are called nodes. Info pages can be navigated from one page to another through these nodes ‘info syntax info (OPTION)... [MENU-ITEM... tlons -k, apropos = STRING [ look up STRING in al indices ofall manuals lirectory = DIR add DIR to INFOPATH, dribble = FILENAME. remember user keystrokes in FILENAME. ate | fle = FILENAME [ secity Inf ile to visit | | + help, display this help and exit, | \ ~indexsearch = STRING 0 to node pointed by index enry STRING. | ‘node = NODENAME specify nodes in first visited Info file. | | ‘Output = FILENAME ‘output selected nodes to FILENAME, \ | SR, ~raw-escapes output "raw" ANSI escapes (default), | 0a output escapes a tral text. y van } veer HUNAN vo a beh FALKNAA, v tahun option, ovage | yo command ti ote ole ; sues wy pum Hem, whee vb lak ay ng, \ hs | owt, ao flat jon Information wn ext, se! lation oft le example Sto date 6 help command Q. Dplay formation abot bun command, Displays viet snare of sl ulti commands, Q.IEPATTERN is specified, gives deta hel tho listo help tpi i pried onal commands matching PAT Ty, (Tor all of ts advantiges, «big dsadvantage of the command! line i tht th sommands with too many options and wange, help syntax Help (dns) (P47 TERM. shel option here aa) But nobody can remember all the command, 1 output short description fr each tpi cin disply usage in pseudo-manpage format, “$output only a shor usage synopsis for each opie matching + ‘With most every command, help" epton shows usage summary for that command. help exter help cho Display a bret description of the bul shell command echo, $date help ‘Usage: date [OPTION)...|| FORMAT] (4 date [fuel universal [MMDbivunm|{CC]YY]fs]} [Display the curent time inthe given FORMAT, ost the system date, i Sash asa builtin help fcy asia foreach ofthe shell ulin, Optionally, you m9 tn option to change the format of the output, Output of help c Whelp-med mand: NAME ‘ed Change the sll working directory, + SYNOPSIS cd [USP] [ir] Ne ZZ LA A be ie a Yt! H0N srg sell Working dirty o 13 cane the current directory to Dip, The defau py Ris the vl theHOME shel! ible, se vate ODPATH defies the aon ath for th distry names in CDPATH re sper * dey anng DR. Atenaive By ecto die ape cure directory. IFDIR begin with, lh te oman ne is the same as ibe Ga 7 edt het pig "Nie hy ods asund a bea ‘variable name. If that variable: ‘has a value, i Value is uel for DIR, opin: 1. fre symbol inks tobe ove Pusethe physical dtetory suru wits following symbolic inks ‘Teds to follow smb ink asi weed ‘Exit Stans; Returns ifthe directory is chaged;no-aroohemise . SEBALSO besh(l) PLEMENTATION GNU bash, version 4..5(0}lease (86 poling) yi (C)2009 Fre Softvare Fount, le, tite on notation: ‘When square brackes appear the destin of command's syntax, thay Sa optional item, "Seba crn munally exe em te of teed cand abe SOL) (ai "on says hatte command of maybe fllowd oily by eta ora "nd & é * Optionally followed by the argument “di” “they . design ofthe commands Seth ntti i ‘yt Mae, ‘and options, For example: ** "kd (OmTioy DIRECTORY. i De Create the DIRECTORY ies), if they do not already exist vs y oo ~context»CONTEX'T (SELinux) set security context L to CONTEXT Mandatory arguments to long options are mandatory for short options too, ~m, -mode=MODE set file mode (as in chmod), not a=rwx ~ umask “parents no error ifexisting, make parent directories as . needed + ~-verbose print a message for each created directory help splay this help and exit “version output version information and exit | 64 More documentation sources d Hat Enterprise Linux Hat Enterprise thas one of the best documentations ce basis of RHEL to advanced topics ike Security, SELinux, virtualization, directa Server, clustering, JBOSS, HPC, and much ngs, ean Red Hat documentation has been transit into twenty-two languages and is avaabl ‘multi-page HTML, single-page HTML PoE and EPUB formats The RHEL docs covers everything fiom installation to configuring clusters. Arch Linux isan independently developed. | Linux operating system and it comes with, prety good documentation in form of wiki based site, Itis developed collaboratively by & community of Arch users, allowing any user to add and edit content. ‘The articles are divided into various categories lke networking, optimization, package management, system administration, X window system, and getting & installing Arch Linux __ TT Gentoo Linux is based on the Portage, ‘Srckage management system. The Gentoo, | = eer compiles the source code locally eecording to their chosen configuration | jnstalltions, packages, networking, and ‘much more. Gentoo bas very Forum over one hundred thirty-four plus users who have posted & thousand total of 5442416 articles. See SEE : and Documentation ‘Ubuntu is one of the leading desktop and laptop | distro. The official documentation developed and | maintained by the Ubuntu Documentation Project. 5. IBM Developer Works UNIX IBM developer works offers technical resources for Linux programmers and system administrators, 6. FreeBSD Documentation and Handbook 7, Bash Hackers Wiki as agin ale nt oh ee She Speke Sitesi SUM Sees oe amas aac aes na yal ia ee Ont dt a Soden ‘Sense Orie ys a fei tea the ick Seana 9 so 4 iit inn ham ait evs iy a Ys eh te We —________}. information containeg Tea ay ee? work wih other Debian’ YL gow This is a reference for Hecht ve ‘Howtos, Tips, Tricks, ang t's Linux has one of the bigges Hac communities on the wet Tecontains hundreds of age and tps to help developers i Programming and application | development, as well s Lin administration = i ‘The FreeBSD handbook is create | FreeBSD Documentation Projen. It describes the installation, ani and day-to-day use of the FreeBSD 0 BSD manpages are usually beter ‘compare to GNU/Linux man pages This is an excellent resource ros) The bash hackers wiki isiotendel 9 documentations of any kind abst Bash, The wiki is divided into various #0) such as ~ scripting and z howtos, coding style, bash symm much more ‘The site provides Linux tutorials about Various topic including its famous “The - Perfect Server” series, | The sites divided into various topics such as web-server, Linux distros, DNS servers, Virtualization, High-availability, Email and anti-spam, FTP servers, programming topics, and much more. The site is also available in German language. documenting open source software, and programs with special focus on ‘OpenBSD. we ef wt acnbveecinapn) Tisis one ofthe cleanest and easy to to * Soret navigate website, with focus on the Fae teat quality content. sions * vr ex novice] The site is divided ito varius server eiiateest| topic such as DNS, OpeBSD; security, web-server, Samba file server, various | tools | This amazing site dedicated to ] | ~Sickware Book Project be Revised Slackware B40 ‘Slackware Linux was my fist distro The distro is targeted towards power users with strong focus on stability Slackware is one of few the most “Unix- a like” Linux distribution. a = —_—_¥__— ‘This is divided into various topics such * as Installation, Network & System | Configuration, System administration, Package management, and much more. ' ' “cuorsmypu] pueaMoD yseq -poureydo zou ae pur | ee Bile Sass ‘muy Hmureo| 305 2omn0s91 | 2 nous st Supquongou autoy xu | *engnanson seeNL ATEN C149: OLIACKI ENC. O'S amg Anamanuers anu mew 7 NEEE Bappsoma9N owOH kMOT] ZL “emote at SE = “Susvweerere woLoK aan ae (eae ere anni wotlnn ed smeuatied SOC <7 enry Sxe0 Ye WO pau ees pu eT 2 ‘ ae sn ono 2 SEE sone a0! 1 sou ey “ vote soreod eo a ta vonsweoa00 86 te ond yung Uo 210% HONS Esty, gogrueo nur TAUPO WO AOU HOH anos WBS 9 15% earn TT yeep on cone yo ot" ur om oman pares deg nT ej ug PERS RH nd yo w99008 Ne rant XUN JO GI yp ome ey 138 04 pwned 8 yom an Ko HO peor ross pas asnge00 HN 01 SPU cng Sis fi UT] HOE ‘uosyepunod xt u u ‘ + svonsyueamood ‘qreayouys pus [9uI0TBO UO ou UOYS Ban zy uuoeiuoumaog SOs PU moo ent] UO BOW UOYS AL =|, ionmmuaumaod tuINAA] VO OU HOUSE ALA, oy uoneyuoumood | asqeezy uo 100 HOUSE MUA “6 uoyewaunood ‘nyungy] UO HOU HOYSe aUA, -g ogeqwoumaocy =U] YHP=R UO TOU HOUSE SHAN reap u uogeauoya woyReauTandl xTUrT 198 6 SAA maaytp 9 1909] 24S 5 : ord si gy TUrT w pusena0g OFEE AND TEKH s -pureumuiod djay yo suondo ywoxaygp o78 TEU ppue pasn st puBca0o yon emery] Moy urDdKs y vento si us PURIIUOD We eK et wn yo nono wa. 8 TUM THEN -qryosn are Aatp e404 pe S08 ‘cyunnoc) mr Jo diay 728 01 OY URLS soGed pene ynomp SP om ss0mH KRU JO HHO ‘gaou saptaoad 9pis 24) | 7 rz ayy Jo yonposd e st woo x ojuy xm so 90.nog aL — wOxNAT 1 “yer0ge(o9 “aOTUT oF OPLNPL ve uowmatzopt soxpo pur speuowa ‘S9pET “wonepumiog. MU! ‘SOIHaVO a egvons /2e10 “‘nurT “Butpe vs ownenou wa oopta nut] “TA Se Hons O7UAyOS ynoge sjenuem Puy [IM ROA syeuttoy pus azeAgOs ‘aaj uoddns ‘sorenygos aomos uado {yo aos © om PUT [SUL OF pur 209, Phony exo ven Tene 98220 ‘joo. asotn saan egnamusuioo aif pur Wat asm sjon tg tn Jann. eynos uado pue 22) MOge sTenueut yo wona00 © STPTUN SSO faqnn (7a) Soumpry g'2°TZ Arqag vorwsadwog yy CLL worsserdwog 21-2 dapeg UZ suondo tau sf ‘d> ‘aus spuvuruog 3997) MON Z'STL pono ‘ald Suaoway 2g Suymora ‘Supuaddy Supra STL sogonanp pur sory Hua SuppOM, STL somquar Td FTL sod od, €°TL ampere unashsay TUL watson TTL A suonendg mF UL yampnygs | 9 dena Bujaryoan pup asojsas dnyong jrfianod D St 40Iy, 4a3deyo -umduroo-xgcad 29 0 pausisop Bus9q STUOG PAPPE AN SY THO g Bea £661 Ut 3909 Jew>y O°T 949 AYA paonponu sem yf douts Yon paduEyD 104 SEH ‘uorpquataydiat ZH ayy g ‘qa Jo udhyonponur ayy fan xT 205 usayshs 219 Prepares oy sea 7x9 E\Ly 0 dn gga oppuny uno ‘qn a(S) WHS A ny] PROPURI OUTING TH g royoanr yuamed sag aun uot ut doa Joora» SP 4] SUONEOO||® 9POUL OG @ ‘porwoo}re uoeq sey apour soy axp yorYAs 01 dross syooig 2ip on a1g aun eo0Tr® oF sdware 2 SPI wUp Jog "apy IWIN 10} dnow# 49019 AP payee 381g won 7H OT e SuNROOTR UI stud yo apa ofus © spuodseucs dno ied 7 uy sa0o fotod UOROIE ZO AY : wwonsampu "yo stona} samp o1 dn ypu wosks ay at ano wBnasth $2019 oourpuy ur suoyutod 3909 erep ou Buu0ss ‘91g aytoods « or BuiBuojaq syo01 TEP evy BUNEDO! 195 ‘wsfuRyoU ZeTUNS @ S9sn a é wwarsts ag 156g ISA tH wourwod Ut Yom sey ZH OH russ aly “ayqey uooiny swt aoe ours ‘aup e 2q seas qyas woezado peal S21g tN 205 cuonsury orepdoxdde we ang “91g Asovoaurp 30 31g tp {21g paxsowrsu @ suasaxdar apoul ue RU ‘amv 10 MOU YOU S20P SHA AUL (2) Pd “agua Sumpeap st 300090 JO punf WEY ATEN spieape wy OW 1 Buy mo ee} uoweUTY SAAD ap WON VORRMTY camnudoxdde ou uns A sootgo wnat gp Jo a0 vo vopdo ue ng we 298] anAHOS SUA Mt ® "oafgo yeu 30 suorezodo paugap ot ru2uz9| ct we) SuONAUTY onape aun Jo Sossemppe atp ist age UONuTY AL IAF uonoury © o} zequtod e surmuoo sad Death 2u0 Jo 129/90 AtsAg SuonezAdO J Sw UB Si, ‘sada x Au Axon fenptafput ue syoaseudas woxsds ay angua ue syusoidossoafgo : ‘ayy ado te yuasasdas eee ‘qu renptarpur ywosoxdan sods wofgo ure atone a1ay ah “dnos8 sapunto (zp dnos8 99 on-aremayos Jo 2968] © 32 PUE 2] YOO] 07 PamoTe az syoatgo sp rey Agtoods 1 fo ws es] svoundwoo Z sm 11 ssyaud peu ofp ot panos ‘paussap $1 S: ‘qy uado we weep atp 0 $s2008 Jo yuiod w yuaseudas 7oaiqo ayy noe a mus HAIER ae SHO RIN AEN AP . “slg ty ssan02 01 pas susnreypou a uv apr paren ot aun aout um we as dasa a ‘eyo 024018 1 iy a(duis Aue Jo STEP oneuowojdus oun Spry Aq apg Jo sadky asaxp yrs sanpured [>t be xu Ut 919 241 AO mo stays a san 201420 BP 3 yo nino 20 me 24 Sp ry 9g eo sa1g xIuR ane 98 ~~. ‘uy woy "aU B 4940 PY) 30 YBIP Uo pays 190(g0 ww 2q 0} anny ou saop 215 © ad aye Teese 08 oy OT UN >, sr] Jo amUoNANS 2241) araical NR wud og uand “Wun ura ye sazyaurezed 8 O pam aq uta 201d yah 9LLVE ‘TLLVA Bung sy sous yy Jo suDS:04 any wang ane im OEY WOW. 05 1G GE ova 71 WHO papuaie ag aut sy 20 ‘Lyd sata ae Po nme Foy Ba aN ay OR EAL LYE ORIN @ IN yy ss BoauBaq works Sumesedo yosoioyy Jo Ssoung fe quam sowoD yg ceva yam Gg 22a yor dn Yoeg 2098 wz ay pur pam rr azote 805 dn pug you woke ag ayn suononnen 0 TE NaMena 2fy peuTuREU Jo pon ¥ soy Une ap wa to oe by "warsés Buy Epa ue Bmp su0p 99 > ape ei kB nox worse ay crs 98001 Kno2as pu © Yamunot one pun “qua Jo. same word “uD a yo pens zyx9asn mou snayep ana pur 1009 iH PI gaat Mt ea in “915 uo] syoddns pue ‘aL Suomen cess SAL SAIN SIMONS OY ANU] [Ing ay smu yo omyanas 90m Aaovoamp 1 YO Prey wazed YO (mUYT Jo eauoNs 211) {OSH dono Sopsss ty MISA 9 eunjoeHYyouy We}sAsejty zp Tats ag Suqoamol ig 79 OMOEA, oy Tn ‘wasshg aftd OSE | si a woreauoyay mayshs ysseooy [MA = wets 915 SONIA = SUT JO woRR Te al 5 ss008 PONTE IF MINTS aI GINS PGES waists 31g IN yosOsDIAy 205 HONS (ROWAN) wersks a1g 0996 OSL a ee “smu reypayy1u2umo ay) UF posn “Bueunofsuodkns ‘woreds apg papuaneD PAULL | wes es warahs at WORN | _— ag eo ee "9 120 Sma PRBLNADE poprnond“umIaTS ayy papuRTKD PIONS |_——_ wana yy. MUTT jos ayy —— weiss apg papuarxe xT _ ‘EUS a tp ipa paBunTD oq avo suoue si warshs ayy sord 24) wo. vopBu9;UY st S98 ‘sd ‘puemroD haa ssoooid 2 sos aay uae So © pusoy, ueyp oF pur 22eMPUEY ,wWosKs v noge uoKeuuopL parrap 198 04 posT 2 unt wid & 6 0205 POT TY, mag may pai Toe OL See, atime a 2= cporypssh nse eee sop o eth ons 288 2 he -, - peer Py aay y ary UQY : 2 9iy oRyRPEY TM WO pory ees FOE a yougn Sw oMeR ANT -10-0102 960% HEAEITS 1003 7 ssouorzautp Jo 3upsy 2duoxy Py dod |e] ef ! a jksorsastp BupHOM yoasoad Aor uy ma4p 3 44 OF Ao | ROA 3M I sj UT Trango prog 24 apg ap moet? P AG PRERNP! on “sur on sey 200 ue [-] saL0%6n Lappy 1s 3009 Ur ang Ht yo adfi stn puy ayssporsaig seynBou sure so(y Jo 244 assy adi any Aso1200 7 cy sey Asozzonp Axon souls ‘ow oF fanbo 7 sotnop [wotskyd ® Uo pa0¥s SOI [P08 ae gdurraqnacuns — so¢ PAUPW ZEET GOA'SL BAIA #1 He ssouunegsted], 02:17 0€-10-0107 SPELT HF auma3s01 Bp°ET 1E-10-010Z 72598607 UPL AP =: sopaf smn B24 f0 Busy aaMory df'g1 ¢-z0dedtTeM~s25°9.L" “-aodiSy “raquana apouy 2fBays 308 TTA panwos9 wom af AzeuTP LO rang ESI | sony Axwarpsooae soy 201802 souls ¢ [sf wosy puswstnos dos8 Buysn 49 S21 ureuayg yore! aureuaig<0 ‘won so apg cauld ¥. t 1 30 21g 1PEU ay wo goal “ra WWM payeorpar az8 ous 915 2% 2 gh TPM pareoipt pr an 2 @ uy ayp Jo Buns ou ve wndyno pumUTWH0D |= ~ 6 “80H pam oq =o VA} exp 31 08 28 255 0] HRs, ee oop APRN UP U! PHOS FENITE UE poe Wash a a aoa: ale asap ARID Om UA! SUS 2m 2H 0} \ ema oy, aoquuts y ‘ reise pet FF ee ay 9 pte sdo0 ru ody pw ASoo manera unto PRE WNSKS 2p wo 91g sues 2p Jo send: HUY] foquids, w949q 40H paey fya0 ue> no, oj Bugs 3007 Iy Amaezey> Sy] 94 BED 40 PuEUIUOD ofA “woke 1g ap pin awe 9 to nao sues a a Bu8 sao spn dnd oy Poms Os “OaLa wpe sounawios s yaya ‘did pote, e aig aun wpog Jo zaqumo p PI8G wag sous wo pe 81S pros ats IL fa que 0 OS (20/14 porwoop sen iaos0y9 Jo ‘PuettNe9 dos8 pax Fs} Jo day a z ‘60 S1-2o-0107 1 “8 ¥s1P 100 (20/1 pono, sum Gays ‘af ayy 905 01 nok safsony yoOIg Joi DPawunUod 49.8 pew |~5130 diag ayy gay say 99019 291829. "uonzed jem ayeas> 0 pubs 335 : | Sa 7 . ao Sopyoya P22 Aq PORTATEPE ow BUDIUNL SUL as fo BOOT A SOP ere sop 8 FL AAG as pe yy ‘pmnoys 20p'4x snp uy ‘2oprAx or # 0 As01eHP Fo t 200 AxPOY 900-9985 anim eases ae Pe UH MMOGUUAT © R109) |] ag vim oun an 1 z0t08 7 ssmentoo yep povwoz0 St OTE jaqnds 88 PAT OFT8 81 4UN SHOGuig — mop sa HONE BUH IPH BOS TT TUL 0g, ‘ou sutewuon wu 2 tg reds Pe og HRABEP ATE FONUMS V UT Ogu ‘yr gos © 96m 03 AR Th BP antod nom eese9s Z2PUN FON NOAI04 Uy 9, e agmars 3,89 no, “munypam postskad jo sopyy 190494 AUT PAU 996929 Aqao ea nog, " . q se us puw weary a1 aH Jo s2qums 9up SAHOUS TEULIOG BuNsy Soy ry mT sor] ear? ——— if | WHIT pera eee eee TE ERT MAE sae 7 Sau) SuopseMNAT | | ay | omy, pus ovea | 228 | 20° nox | zoamo | J0-0U a9 Tae wea Hag I pe ag yourao xp 30 91 OTS HoH wa Tg = ANN TNE ‘pou oue song yvog vet 277s St ‘uot oures st 2] oup Wiog Jo Haque pout 2tp gt 2g up o au an Aad PIA POMS ue zaqum pout ayy sXeydsip preg 14 as sa ae we P| wat plorrsis a sows fyundosd poneoso 5a HH © aR 7H saan pro ats 31g pateaso 29 100 pinoys ay amgqn agro oan oj nav pur 2jg jeuu0 wou ona 210 SOP? poe S61 yon s,uU> nok ig (san) es ae auras any Agave st 2 arn plow app paEY agp wo porary am ia wep aTy wtoads © #1 PO aL am wei uot wt nba ames po prmzpid 29 0 St PIEY SUL, 7B PIN 2 Se gunn open spdos mie cars cared oma one sian asays “Kdoo © 05 (Gqueas ut 08 2powt ames op amas sary — a ‘BoyAapy SE:60 $1-ZO-OL0Z 0 1001 1001 | =Au-AU-AUS “Bly 1HP0s jo Bupsy durex sy dost “puruneads dax3 pus ts J0 dom ayy qv STG YHDOS Jo 5H 995 7ar{o0s ayy wos UM pure peDL OF sTTeo waIsks ontim C222 ok pus soidi2seP 91g 9X8 Se OURS 81 SL]. ‘PHyBOS otp Butsn a1y Yo90s sm 07 Jaj9N WED NO 2 {@ WYRULS OOS “LANI dv)i29P0s = ppIp05 UE Jepim ajqeiteae (feo wasAs (yax0s Buisn afy yoxD0s @ 218039 ED NOK San 129905 29891 asodmd uoneotmunos 203 suonearidde woamjoq uorewiopu ssed 0} pasn st 214 3240s 3931205 (2) SERRA raanenanes| Z/PHEIAS/P0Id/ <- LAPIS S£:60 1-20-0107 $I rons ne] Ispus/ssoypumose/o0.d) <- EHPUS 5€:60 $1-20-010Z Z 3003 001 | MTN DENAT soly pay jo Sunsy apdurexy by daa Es} ‘puewwoo des pur [- sj Suisn 49 soy poxur] 1st] wea a aUEUaLFYM/oWeUcLOaNIp/ aureUaTyTEMTELI0 s~ oy UY] PLB] euieuaTyyUY aureuarypeurstio uy. pursues uy 250 "aly yur areas ut] prey pure (oyoquiAs) yos a1 xturypenury ut aiqelrEre saIg uN] Jo soda ova are ars ‘Sums 81 915} UH] pzey pu a]y [euIBLu0 Jo soqumu apoun aouay} Ks0; 321 poveazo st arg amp Jo HUN PIBHY “WUDIOHID st 9]y HUH] atfOquIAS pue 9fy [euBu0 10y z9qunu {now Azonic saygto aze Katy Aso}oouIp wwas9gp # Ut SIG LaXRO 04 Sq PAUL axe aso syBsunppwoy spysunpaui0y, pads AUN] ovjoquuds st yoryar Auo}exIp Jo sauswu aquurea wayscs |eIoads v st ;Pasn st a]gELIEA paso uy os[OqUAAS Jo swrBU a4 KBldsIp OF HEN Ne sRa/SUD/AWOY Pad ¢ SUIS Pos seMBYSUYD!D GOW SUIS ‘atu ou auv S9|yy YUN] "PH St yorya uondo f-s] 30 play ada Operations 183 rwarwxrwx | root root 0 2010-02-15 10:07 /var/run/cups/cups.sock wxrwxrwx 1 root root 0 2010-02-15 09:35 /var/ran/samba/winbindd, |_privileged/pipe 15 09:35 /var/run/mysqld/mysqid.sock al srwxrwarwx 1 mysql mysql 0 2010-02- 114 File attributes The Linux is divided into 3 groups owner, group and oe : + that Ele. Th a 1, Iti er who creates 4 particulars le called as owner of that ile. The owner is a Seleatl et rights on the files created. by him and also decides the rights of other user associated to that file. The owner group is abbrivated as we 16 ‘ ‘cal software development one large project is divided among different members » Group: Ina typica developers requires that file belonging their project should not accessible to — on enftware eee cere. [tis abbreviated as ‘g" 183 sw 11s 0020100215 1007 ar rupup sk rt e000 201040219 09:35 /vt/runammbalwinbind.pivileyed/pipe | “ ot cos La ya 0201040218 09:35 runny aoc ile anteibutes 1 gs vie to 3 groups owner, group and others, y is tho user who croutes « particulary file called as owner of that file. The owner is a ‘owt 1 mnt ho as all rights on the let rented by him and lio decider the rights of other user sete otha fe, The owner group is abbivated a «_ crvupi Ina typical software development one large project is divided among different members ‘So software developers requires that file belonging their project should not accessible to ova tea Sper users hence they will upply right to group users, It is abbreviated ws ‘g” « onbers: AI! the users that are neither owner nor engaged to with a group is called as other normally guest user Abbreviated das ‘o'. Lie group jpety Bile oF directory which is to be created will be assigned to a respective group with fille dicodss tributes of Linux: ‘Abbreviation Description ‘With this permission user ean read the data or file, ser ean not write jon user ean weite the data or file. — ‘user can execute he application. All three users have all three read, write and execute permissions permission— : 1 read owner group others wewite | “wes “nS TS x execute ~ a ~~ te Unix permissions Wor Werg * ‘aad a wos ®72Cut orp ex02Ule group Group aod ~ 184 To understand File Sy v ‘Attributes , understand the format of permissions Commang : Attributes: ‘ A : Format of Is -I FileType: #ot Hard Links 5 File size - Permissions ‘Owners | Last Moaity Tine : — | 1 Vewxr-x--- 1 walbert support 0 Oct 3) na] LIM ine re Ol user» Y other User Group 5 Grows 5 = (file) ; . . 9 (directory) ~ 1 (symbol tink) a b (block special file) © (character special file) a p (named pipe special file) § (local socket special file) a Output of Is +1 is as shown below: SSIs 0 [ Fite File No.of | Owner | Other | Sizein byte | Date & ime ist] my a < [type permission | tints | group modified a ~ | weve | 2 faBCother |“ | 6604096 | 20070820 | im] 0 | 1534 Lf [worvare [3 | xvzaBe |= 1250 « 2 | 4 warwxrwx | 1 DC other - 950 “ = The file type (such as directory (d), Ordinary file (-), character device (6), or block devi i ‘The permissions forthe file: rw for owner, group & others. ‘ é < . + The number of hard links tothe file (Links of the file in same directory) ‘The usemame of the oxmer ofthe file, : ‘The group name of the group the file belongs to, : ‘The size of the file in bytes. ina ‘The time the file was modified last, pa ‘The file or directory namePart I. Ps ‘Apart from these File Attribute, Linux has attribute for applying security tothe file = | Ghat (Chang Atri) s command ie Linux uty thats used to sethnse et s= file in-Linux system to secure accidental deletion or modification of important files though you are logged in asa root user. a, In Linux native filesystems ic. ext ave full permissions on it. , (2, ext3, ext, birfs, ete, supports all the flags. One cannot delete or modify file/folder once attributes are sets with chattr comma 1d, eve e's info are dow files wherein user's in is B99 USEF oe atts ig ‘system files like passwd and shadow files Py of chase TT ‘chats [operator] [Nagy {flename} Fase Forel crit 4 Following are the lis of common “Srbutes and associated flags can be setlunset using the chatr nd. ce . 2 Hfafileis accessed with “As ‘Muibwte sey, it's a ‘ime record is not updated, 7 2 Hatfleis modised wit ‘bute st the changes are updates Syachronously on the disk 2 Ale is set with’ abut, SSD caly be pen in append move for writing DA Ble is set with + tribute, cannot be ‘modified (immutable), Means Ro renaming, no symbolic link creation, no exertion, xo eit only superuser san une attribute, oA ile with the + atibute Sh all ofits intormati updated to the fie itselg ‘fl is set witht atrbute, otailanerging A file withthe attribute a o @, wal no mee: Fortackup when the dump process nn, When a file has ‘y atibte i one undeletion. Operator (fron, 2 root root 6 Aug 31 18:02 demo 31:17:42 important te.cont SeawrWx. 1 root root 0 Aug ann. Ne sign wiht ca command. So, 4 ye use the + sign and to unset use ube fe ni + flags to prevent anyone rom deleting a fle even a ont Frision to delet it ser don't have Wehatte +1 demo! } chate + important ile.cont Note: set, ican only be st by superuser (ro!) se oF 8 user With do priileger ‘The immutable bit +i can only Mable ty Betting : ‘ ‘Isat’, 18 immutable bit, let's verify the atribute with ommand y efuly, rename or change the permissions, but WW com, tried 1 delete <= “Operation not permed” }# rm -rf demo! Bees sm: cannot remove ademo&: Operation not permited je my demo demo_siter anv: cannot move demo’ Co demo_ alter: Operation not permitted Je chmod 7$5 important_fileconf med: cangng persons of mporantlcol Operation nt permite peering _-2-How to unset attribute on Files oe In the above example, we've seen how fo set attribute to to secure and deletion, here in this example, we will see how to reset (unset attribute) belied files fy F files changeable or slterable using -i flag. Nssions and, Alo jf chattr -i demo! important_file.conf J#tsantr ‘demo — important_fle.cont s Veulssss is AHO ea That sl ap aed eel ee ‘Yu se inthe above resus thatthe i ag removed tha means you can sly emg and dretories reside in curtent directory genre gegen }#rm-rf* His total 0 O File Stat- Display Information About File For example, to find out more information about 10thacks.txt file, execute the stat comme showmbeow | § stat 101hacks.txt | File: iome/sathiyamoorthy/101hacks.txt Size: 854 Blocks: 8 10 Block: 4096 regular file Device: 801h/2049d inode: 1058122 Links: 1 | Access: (0600/-iv-~--2) Uid: ( 1000/ sathiya) Gia: ( 1000/sathiya) “Recess: 2009-06-28 19:29:57.000000000 +0530 Modify: 2009-06-28 19.29:57.000000000 +0530 Change: 2009-06-28 19:29:57.000000000 +0530 Details of Linux Stat Command Output ' File: thomelsathiyamoorthy/10thacs. it’ ~ Absolut path name ofthe file Size: 854—File size in byes Blocks: 8 Total number of blocks used by ths file 187 block size for this fi A si ue iets the file type. This indicates that this is @ regular file. Following are 4 oe file tyPS- . : Oe le, (ex: all nonmal ils) a wen) (% directories ). 2 A, (ex soket cic ie (ex: symbolic links. ) 2 spi flee ad i). ver pei le. («emia eve Sle) pes 0120098 Device number in hex and device number in decimal j node: 1058122 ~ Inode number is @ unique number for each file which is used for the-internal menace by te file syste. 4 inks: ~ Number of inks tothe ie 3 ees: (6C0LT#—) Ase psi lye in both octal and character format. Let us see eats about oth the format 4 (100s) ~ ile owme’suer i and as ramet displayed. 2 Git: (1900 sathiya) ~ File owner's group {id and group name are displayed. 2 Access: 2009-06-28 19:29:57.000000000 +0530 — Last access time of the file. 2 Modify: 09-06-28 +19:29:57.000000000 +0530- Last modification time of the file. O Change: 2069-05-28 119:29:57.000000000 +0530 — Last change time of the inode data of that file. /15Working with Files and Directories 1181 Creating, Appendling, viewing & Removing ile, Directory File, |. A file is a container for storing information. : va inthe file, not evens name, Ali abuts are Kept ina separate 2 A file's size is net ate the hard ds ot diet to bumans, but oly tothe Kees 1 yell A directory is simply folder where you store 3. UNIX treats directories and devices as file 8 flames and other directories, All physical devices like the hard disk, memory, CD-ROM, printer and modem are treated as files. Creating fies: "Using cat to create a file: 2 Scat>kiran.txt This command is used to create @ ne Redirection. ‘To save this file, etrl +4 option is used, ctl indicates end of file mark i eof mare To interrupt in between tl +2 wed Tha mand eee at rfet the cones oh sandard oupati&, Consle to the 2 ‘Tewly created file named as Krenx¢ 709 ie Using ouch comma S touch kirantxtravitstchirag xt file known 2s kiran. with the help of output 188 a y - It creates three empty text files. 3. Creating file using vi editor DS viravitxt sf Appending fs: a Scat kirantat >> raviant s This command is used to redirect the contents of file kiran.txt to the stan, s thee cones for appending (adding) into file ravi ie, Kiran. cones yO) the ravi. be : ~~ Q Scatnewflle.txt : ‘This command is used to redirect the contents of file chirag.txt to the : these contents tothe file newfie. ie. Chirag.xt contents willbe redireteg @'™&a, newiletst rot | Viewing File Contents: x \We can view the contents ofthe file and how to view or how to peek inside of them, 1 commands availabe for taking a look inside files without having to pull out an editor," ‘Viewing file statistics: ~ “Is command with -1 option is used to provide lots of useful information about fle ia format, There’s still some more information that you can't see in the ls command, hy The stat command provides a complete rundown of the status of a file on the filesystem; $ stat kiran File: “kiran” Size: 6 Blocks; 8 Regular File Device: 306h/774d Inode: 1954891 Links: 2 ‘Access: (0644/-rw-r~1~) Uid: (501/ rich) Gid: ( SOW rich) <=. “Access: Sat Sep 1 12:10:25 2009 “Modify: Sat Sep 1 12:11:17 2010 Change: Sat Sep 1 12:16:42 2010 3 The results from the stat command show just about everything you'd want to know at being examined, even down the major and minor device numbers of the device where te stored ) Viewing the file type: + Stat command produces all status of the file, there's still one piece of information mist type. Before. you want to view the contents of the file, it’s needed to know what type of flee identify whether it is binary or octal or text or ascii or device or ordinary or link file or shell 8" iss directory, For that file command is used. It has the ability to peek inside of a file and ~ kind of file itis: $file test testl: ASCII text $ file myseript _mysoript: Bourne shell script text executable S file myprog ial? riyprog: ELF 32-bit LSB executable, intel 80386, version 1 (SYSV), dynamically libs), not stripped peste command assis Biles ito tec J rex fils Fils that conn pn ore 4 sxetble is: Files thet youcanranen ee : Fil tem, 3 a ile: Fls tht onsn cpt inate be NM can'trunon the system, ein il commands helps you to deemin ra we quermine classification fori, The le oman ed tee ene “he fle emd looks for a special keybwords or special numbers in those first few lines only bt it is not arouse, Hence OD’ omd is used to examine the entre le by by bye ‘0D isthe ‘xl dans" + ors the dump of il 8 it prints every bint vl preston, File (directory name] i: Fle OD: it prints the contents of file byte by bei inl hae ox adecims ex henadecina. Desptons pines | Once) TL O/Ps a decimal frm of byt a ThovPs hexadeinal for oft whe eee 2 11 OrPs octal form of te ib on Viewing the whole file: apleo see wha’ is of you have a lage text ile on your als 2 a costes ‘There are three different ‘commands in Linux tov The cat command: anf ais Theentcommang is 2 used 12 S506 Scattest allo Thisis atest file. That we'll use to test the s ay be il Cones of the txt fle Wily gt ‘ommand, The -n parameter ™ 2 Seat-n test ‘ : Valle 2 cat commant ones HE with the oat This tet file — 6 That we'll use to test the cat command, Sac s If you jst want to number the Lines that hay, = when you're examining serpts : toy iy parameter is for you S cat-btestl Thello 2 Thisisa tes file command nat we'll use to test the c2 s antl If you need to compress multiple blank lines into a single blank line, us the rane Scat -stestl hello This is 2 test file. ‘That we'll use to test the cat command. s if you don’t want tab characters to appear, use the -T parameter: Scat Test! hello This isa test file. ‘That we'll use to“Itest the cat command, s _> The -T parameter replaces any tabs in the text with the “I character combination. Using the more command to display a tet file For large files, the cat command is not advisable. The text in the file will jut quickly 0 ____ monitor without stopping more commard will this problem. Deleting files: rm: Deleting Files inux if you want t 2 . e — Lin ee oe sing Ble, iat it’s to clean up a filesystem - Deleting is called removing. The command to remove files in the bash shel ism. 1. The rm(remove ) command deletes ane or more files, 2. The following command deletes thre» files: +m chap0 chap02 chap03 rm chap" could be dangerous to use! 3. A file once deleted can’t be , " files from one. Tecovered, rm won't normally remove a directo wl ’ __ Software package, there's alvays opportunites to delete files. 6 That we'll use to test the cat command, . aw > when you're examining scripts, If Want to nu ve ena ieles I you jst want tuber the ies hat ave in hay al so” Scat -btestl 5 “ot! Thetlo wor 2 This isa test file. [ ve 3 That we'll use to test the cat command, sr s : im antl ' ; i {you need to compress multiple blank lines into a single blank line, use the-s parameter: 2 Seat stestl : hello : This isa test file oF That we'll use to test the cat command. _s if you don’t want tab characters to appear, use the -T parameter: Q S cat-T test! hello This is a test file ‘That we'll use to“ltest the cat command. s = The -T parameter replaces any tabs inthe text withthe “I character combination, Using the more command to display a text file For large files, the cat command is not advisable. The text in the file will just quickly scroll off oft ‘monitor without stopping more command will this problem, Deleting fil rm: Deleting Files In Linux if you want to delete existing files. Whether it's to clean up a filesystem or to remot ~ Deleting is called removing. The command to remove files in the bash shel 1. The rm(remove ) command deletes one or more files. 2. The following command deletes thre= files: rm chap01 chap02 chap03 rm chap? could be dangerous to use! ‘A file once deleted can’t be recovered. rm won't normally remove a directory, but it ca” files from one. 1 my sometimes need to dele al when used by itself, represents ll files ina All tes, you can ge? POF ny All file gone nontions: eractive deletion (4i): Li . 2 natn bleremnag ce §rm-i chap01 chap02 chapo3 rm: temove chapOl (yesino)?2y mm; remove chap02 (yesino)? %n am; remove chap03 (yes/no)? [enter] a [No response ~ file is not deleted. ‘Ay emoves the file, any other response leaves the fle undelete 1D Recursive deletion (-r or -R): With the ~r(or-R) option, im performs 2 tree walk ~ a thorough recursive search for all subdirectories and files within these subdirectories, At each stage, it deletes everything it finds, rm won’t normally remove directories, but when used with this option, it will, ‘Therefore, when you issue the command mm-t* Behaves partially like rméir ni ~ Q Forcing removal (-f) rm prompts for removal if a fle is writeprotected: The -F option overrides this minor protection and forces removal. When you combine withthe option, itcould be the most risky thing to do: 1m-rf Deletes everything inthe current dicectory and below “The sic form ofthe rm command is prety simple: Sim-ites rm; remove “test”? 2 Sis-1 total 16 at dewar-xrex 2 rich rich 4096 drwas-xt-x 2 rich rich 4096 Se? ont aia ‘rch rich 6 Sep 10951 #5 .- [rich rich 0 Dec 3 a _ rust Brch ih 6S ve so ests >t i ption makes the command ask the user 92 dir! Irwarwanwn Lich ich 5 Se?! sure that oie ha comme =e file, Once you remove | ‘hat has links to it: ay Smmeestl Sis ingiiabou ding 06 san pei ; x Dich ich 4096 Sep 0642 rich ich 4096 Sep 1 09345 ira! 1 righ ich 0 Des 252008 tes [rich rich 6 Sep 103351 test4 Iwan ich ich Sep 1 09:56 t5 > Scat test hello ~ *Scattests cat: tet$: No suh ie or directory s [removed the test fl, which had both «hard lnk with the test file and a sof link wih Noticed what heppened. Bath of the linked ies stil eppear, even though the test fei. a (although on my eolr terminal the test filename now appeas in red). When T lok a the cay test file that was a hard link it sil shows the contents ofthe il. i} ‘When I ook atthe contents of the test ie that was a oink bash indicates that itd, ~ more, (Creating Directories: | est 1. mkdir command is used to create anew directory. Syma i aki . ‘The command is followed by the names of the directories tobe created Example: mkdir Kiran Kiran directory is created in he current rot path, __ 2. Directories and subdirectories are created with the mci (make directory) command. 3. You can erate a umber of subirectores with one mei command: ‘mkdir kiran chirag bo 4, The system creates anew dectory and assigns anew node number. S. The following command creates a directory tree: kar college collegelkiren collegechirag J Creates the directory tree fy This creates tee subdiectrie-college and two subtiectores under college. Te : <<“ spétifying the arguments is important; you obvicusly can’t create a subdirectory before i's parent directory for instance, you can’t enter P Smo collegecirag cllegetcan college i miki filed to make directory “coleglchirag” No such fil or directory mci: failed to make diretory “collegekiran" No such file or directory wt [Note that eventhough the astem filed to creat the two subrettis, kiran and still rated the college directory, 6 Sometimes, the system refuses to create a decry : = “$ mirmalealm kc filed to make dre “mala”, Pemision denied ‘This can happen duet these reasons: malealm may already ex re Sy an ordinary file by that name in the current dirctory tre ermisions Set for the current directory don’t permit the creation of files and divers she users petng Directories spe bese command fOr removing a directory is rmdir: . gna emdir mai Kiran genoves the directory Kiran, ‘pe following Rules are tobe followed while removing or deleting a directory. |, The rmdir(remove directory) command removes directories. You simply have to do & remove the directory pis: rmdir college directory must be empty ~ ‘The rmdir command only works for removing empty directories. like mkdirsmdir can also create and delete more than one directory in one shot. For intdnce, the directories and subdirectories that they were just created with mkdir can be removed by using rmdir with a reversed set of argument: mir college/kiran zollege/chirag college : . 4. The following directory sequence used by mkdir is invalid in rmdir: § rmdir college college/kiran college/chirag rmdir: directory “college”: Directory not empty scThis error message leads to two important rules that you should: remember when deleting directories (a) You can't delete a directory with rmdir unless it is empty. In this case, the college directory couldn't be removed because of the stence of the subdirectories, Kiran and chirag, under it (b) You can't remove a subdirectory unless you are place! in a direwuy which is hicrarchiéally above the one you have chosen to remove. 6 To ithamate the second cardinal rule, try removing the kiran directory by executing the command from the same directory itself: a Sed kiran 2 Spwd ‘Mhome/user/college/kiran ‘Srmdir /home/user/college/Kiran rmndir: directory “/homefuser/college/kiran” : Directory does not exist. 7. To remove the directory, you must position ‘yourself in the directory above Kiran (i.e. You should, be out of that directory), i.e., move to college directory, and then remove it from there: $ cd fhomeluser/college : Spwd Jhome/user/college ‘S rmdir kiran : ‘The mkdir and rmdir commands work only in directories owned by the user. —> 7 % -P 194 SEE Er reece Seer rere eee errr reer 7.1.8.2 Normal User Commands mv, ep, ls with Options Renaming files(mv command): 'ithe Linux world, renaming files is called moving, The mv command is availabe ‘one, both files and directories to anther locaton: $ my test? test6 = SVs atest 1954793 wer 2 rich rich 6 Sep 1 09:51 test! 1984888 -rrr~ 1 rich rich 0 Dec 25 2008 test3 1954793 -rwerer— 2 rich rich 6 Sep | 09:51 test 1954891 Inwnrwarwx 1 rich rich 5 Sep 1 09:56 tests > test 1954794 -ry-t~t~ Lich rch O Sep | 09:39 test6 8 ‘Notice that moving the file changed the filenam ‘Value: Moving a fle with soft inks is a problem: Sov test tesié Sis iltes® total 16 1954888 rv 1954793 3 but kets node mabe a | rich rich O Dec 25 2008 test3 2rich rch 6 Sep 1 09:51 testa 1954891 Irvarwncwe 1 rich rch 5 Sep 109:56 tet -> test 1954794 srw-rat~ 1 rich rich O Sep 1 09:39 test6 ~ 2 rich rich 6 Sep 1 09:51 test (ich @tes2 cls$ mv test testt same inode number, which is prfely fe {oweves the tt Sle now points toa inva fil, and itis nolnger vali link “You canals ise the mv command to move directories S mv dirt dirs The mv command renames (moves) D ttrenames a file (or director). OF Temoves a group of les to different directory. Or Ifthe destination doesn’t exist, filename in the existing direct Like era group of files canbe moved taditesory. The following command moves tf the prog directory: ry chapO chap? chapts progs O._Thete’s 2% option available with mv alse, and behaves exactly like in ep. ‘Copying files (cp command): ies. Ithas two distinct functions it will be created. For the above example, my simply rps ory entry with the new name, stern -adminisators. The ep comm cp source destination , ‘When both the source and mana Panels ae flenaney, the op command opt te 6? cid as the destination, uated file ceo das modised ca i file acts lke a brand new fl ies filesystem to another is a common pr tand provides this feature, La 1 aw vf! in 0 eootmy dou : yo ian nore! jmydoo/kiran : 1 ia fle" current direstory Into apootied path one sel wl ~ cgwetete Hoh rich O Dow 25 2008 kiran pa wet rich 0 Sep 1 09:39 newlle i . ew tenet sows alee noe mune, inating tai completely new file oa ae tha Be ‘modifleaion time fr th nee file she te tune that twas creat cqeconsinn le 1 theop (Cony) command copies « file or w youp of files, It createn in exact tray of the file on ink wi a different name 1 esx require a ust wo fenues ob seat the command ines ‘When both are ordinary fle, che frat id coped othe vecond: ep cup unit) 4. the detination f(t oes exs wil iat be create before copy lakes place. + toot wl simply be overwritten without any wening fromm the ayer, «teri only one file tobe copied, the dentination ean be either an ordinary or directory 7. You then have the option of choosing your destination filename, 4. ‘the ollowing example shows two ways of copying oie Wo the prog directory: «p chapO} progaunitl : chap copied to unit! under progs 4. ep iv often uted with the shorthand notation, . (ot, (0 silly the current dlretory as the destination, _ 10 For intane, to eopy the fle profile fom /homelcirag to your current dlretery, you ean use tithe of the two commands p fhome/chirag/_profile profile Destination is file ittere were only thee filenames inthe caren decor having the common. string chap, you can compress the above sequence using he ° us wsulix to chap: : op chap? ig with cha “opine 1p? progs Copies all files beginning with chap. a oun copying (3) the inate) optn wan the wer before overwriting the destation A Hunt ex, op prompt for ero 1 thy oP teapot unit [ ‘overwrite unit! (yes/no)? y ‘Yat this prompt overwrites the file, any other reuponses ‘eaves it uncopied, — 196 tol 8 SenEESErSaG Copying der statues 8) Mary UNDX commands ae capable ofr wo reat te wma an dese etry and examine al fe ini

or block deve, 1. Read: With this permission, a user can read the data or file ser cannot wrt ino 2. Write: With his permission, a user can writ the data o ile Execute : With hs pemmision, a user can execute the application, The numberof hard links to the file (Links of the file in the same directory) The usemame of the owner ofthe fil. ‘ofthe group the file belongs to. efile in bytes. it the file was modified last. The le cr directory name Pat I ‘The Linux is divided into 3 groups: onner, group and others. 1. Owner: Its the user who creates a particulars ile called as owmer of that fil. The one person who has all rights on the files created by him and also decides the rights o be associated to that fie. The owner group i abbreviated as ‘u', Group: Ina typical software development one large project is divided among die ne | (of a team, So softwarr developers require that fle ctaining their project should not be wx ‘octher users. Hence, they will apply right to group users. Ii abbrevited as 3. Others: All the uses that are neither owners nor engaged with a ‘group are normally all} other guest users abbreviated as ‘0! Changing File Permissions Decoding File Permissions: You can decade the cryptic file permissions you've seen when using the Is command He specify how to decipher the permissions, Using File Permission Symbols: ‘The ls command displays the ile permissions for files, diesores, and devies on the Litt “system Sis total 68 -ewevt Lich ch $0 2007-09-13 0749 file ge , -twxrwar-x | rich rich 4882 2007-09-18 13:58 my evr 2 rich rich 4096 2007-0.08 15:19 ett - s fea 9 i j j nerf her ae fa 7 1 oats $a Ea sent iN et the field defines the type ofthe object, These are the diferent options f file yPes on (0 esd oe trots | for links 3 yracter devi st w | pens sein 3 Theowner | a Trego 13 Everyone ele 0 cgonrwar-k 1 rich ric The emissions can be changed by tO |. Binary Masking Mé 2 ‘ fidelina Masking Method (Relative is method, symbols (Abbreviations) @ for oie Pe for exeoute Pen sion is denied, a 4 or the object ‘or the object up that owns the object wn the system chmod comman Jn this method, binat jethod (Absol Ted permission for ect ‘ mission for the object mission forthe object ich 4882 2007-09-18 13:58 myprog id is used for changing the permissions of ile ways: ute Permission Method! ) ry | or 0 is assigned tothe permissions | = Assigning (Granting permission) 0 Removing (Revoking permission) Syntax for Binary Masking: 4 code that describes the permissions forthe files and ae ces b for block devices n for network devices are three sets of three characters, Bach set of three characters defines ash appears inthe location. The three sets relate the three levels of Binary Number ‘Alename ‘Chmod Group Other Owner 101 01 ul 7 ‘Chmod 781 hello.txt indicate (111) Owner has allt 5 indicate (101) Group user has | indicate (001) Other or Guest oR w Write, Seu a lluses, Sta, loving permission. (Minus Erampte: Che BT hello.tat dn xyz.txt 5 ree permissions (Read, Write, and Execute) Read & Exeoute Permission. User hi re used for esignl x —> Execute, 8 BrOUP ‘ee vAssigning permis sign) as Only Execute Permission ‘Method of changin ig permissions): ng & removing Permissions: o— Others ion (plus sign) _ . ESS Drom, when you start a shel session you ate usa ll want to break out of your home directory and want 71S.3 Working with Directories AS you can see from the shell poe NG home directory. Most often, you wil areas inthe Linux sytem, a ‘The linus file organizes into tree structure format connected set of directories cach di “yet either files or directories, 5 ol Directory perform 2 main functions: 1. A directory hold files. 2. Directory conneets to other diestoris like a branch in a tree which cen be cone, = branches also Sette Files and directories are shown in the tree structure format, [Root LT. | vdev bin home -- a ‘Kiran (Chirag /Angela | uN | Report J Letter| ‘The tre can be shown by oot atthe top. Extending dow ffom the root are the branches ach a | ‘o"s out of other branch but it can have many lower branches it can said to be parent child strates | the same way each directory is a subdirectory of one other directory i.e, each directory is a child of pirat directory. Root is-identified by a forward slash (/), wii ‘re built, coot directory also contain home cirectory which contains the info of all users in the sytem «ach user home directory ie. Chirag in turn contains the directory which the user has made fo his we. Jee Dieses: ‘When you log on to system you are placed within home directory. The name given to this dreary system is the same as your login name, You can crate files in home directory also you can create mit directories. You can change to these directories and stores file in them, Same is true for users on tess © each and every users will have his own directory identified by login name and user in turn can cré® FY tir oWWn directories and subdirectories, i Consider, a regular user account "Tom", He an store his personal files and directories inthe es 7 "‘home/tom”, He can't save files outside his user directory and does not have access to directories of users, For instance, he cannot access directory "/home/jerty" of another user account"Jerry". ae A” When you boot the Linux operating system, your user directory (from the above example ome! sire ss the default working directory. Hence the directory "/home/tom is also called the Home which is @ misnomer the root directory number of system diets he directory to identify th of the it directory isthe pat! . irctories forms path and these path can be u ie path name The a from ‘7 ie. r00t directly to home di ‘chically nested sed 10 identify and reference any directory tory root . | - Pathname: \Inomelrober i | reports | | Letters | Fo T | . Pathname: | Thome/ABCireports Fe | Pathname: | 7 InomelABCleterfile ‘ile writing the pathname by listing ofeach directory the pathname is separated by °/”. When we are og ay pth stars with °7 indicate root directory receiving directory name Eg. omelaboTeters A/S oot Decry Home Dreeiay MOMEDHEO User Orecory Sa Tofersing Directories: The change directory command (cd) is what you'll use to move your shell session to another directory nu filesystem. The format ofthe ed commend is: Sdestinaton vat 4 conmand may tke a single parameter, destination, wbish seis he direstory name you 4010. If you don’t specify a destination onthe comma, it wil take you to your home directory: ~ destination parameter, though, canbe expressed using two different methods: An absolute filepath A relative ilepath _ Mitames are of two types: ‘Absolut path, Nelatvepath, sahil ate ~ 204" _ ee Absolute path is complete pathname of a directory or file always begins with *00tdin absolute Silepath defines exacly where the directory isin the virtual directory stucnae, Seng { of the virtual directory. Sort of like a full nme fora directory, Me a, nis directory & Y | Exg: uslibvapache 1 na ing it check y | (1) Ite fst character of patinme is /, the i's loation must be determined wih espe, Ae we cam write S ca (the first). Such a pathname is called an absolute pathname, Soo sy momelchiis | = = -12)""When you have more than one /n a pathname, for each such /, you have '0 dcend oe S stem Directories | the file system, my root directory t Refative Pathnames: Tre tains Fs | Nau would have sod that no previous example, we did't use an absolute pate tome | gprs With Pros eiectory progs | ssn | Relative pathname begins from your working directory working dtecory isthe. One You ae Contains various | {t:Relaive feats allow you to specity w destination filpath relative to your eanet Toston wn gong to other di Tago Sart th rot A eatv lepath det tsar wih frvard la inating "oid Sor ethe terminal lnstgad, a relative ilepatn stats with either a directory name (i you're wavering tee directory inde) Fare tt) oscil character indicating a lative locaton to your cuteness leain't| of packup to special characters used fortis ae: his alvays @ go | The dot (10 represent the current directory anally or configure The double dot (.) to represent the parent directory. ‘eonfgue the the ¢ notte dot charter isextemely handy when tying to averse 4 diet temdy Goer, aya m the Documents diary under your hme directory and eed goo you bee packap see Girectory, also under your home directory, you can do this: First backup i rich@1[Documents]§ od ./Desktop | oo Minimize ti =~ rich@1 [Desktop] | Tosvoia d Q Save mone Q And ultims ‘Abackup im 1 Restoratio fo Ree ‘What to bacl Use fie et), O Apptica oe 2 OS fites QO Applica s Typesore Ansoute Patsane rae /nomelcisteprtsonday Backs Full back Tneremen ‘eremen # her er absolute path. You can Different Sometimes the asus pth ald be amples Hee 0 fer abit pa Yous Jnaracter tilde * * which represents absolute path name of your home directory. Suppose chara Different cu’ dfeCCOFY ANd YOU Want to pw ~) Wee contents of = ae “nay yo mete ten By enhance puis directory & i: © $€€ content, Of file Fp Metter 80 You ¢an Write Fgeusing it check YOU absolute Path by commani, of Monday din You’, Same way if you aid ecan write § cat ~/FePorts Mondavi a Dod! ie sy homelchris, hich diag YOU can use tilde sign POH displays apn isla th em irectories: gystem Dit ¢ 1¢ present workir OME OFF? Where ge 8 eo ere tilde (~) indicates t begins with jj root directory that ith Linux file SY a contains files and programs head “sl 7 main Saray Several system directories. The system sears wal Programs fr executing SPEtii features op Unt’ Many crecores connie other fust/bin Beier een MANS that user ey aon other directory & the dieson hin hol 7 : ent system devices such a¢ * the commands, -fodackup 1 avays & Bo0d practice to keep on backing up data on our computers, this can either be done nuually oF configured to work automatically, Many back ncanfigure the the type of backu, I, time of backup, sare Backup is essential Features that allow ters ckup activities and many Q Minimize time from disé Q Toavoid downtime Q Save money and time oe O And ultimatety to save your job Abackup must Provide Q Restoration of a single/individual files O Restoration of file systems What to backup? file deleted) or acts of God User files and dynamic data [databases] (sored in home or spesaly configured Partitions or /var ete), Application software (stored in us) 0S fites ‘Shome/user!.dotfiles) Application configuration files (stored in /ete, /ust/locaV/ete or Shom« ‘YPes of Backyy A 1¢ of them: ere are different kinds of backups, the following lists som: Fu Backup : fil backup means backing up everything. set say ‘Weremental Backup op everting tts hanged ice ls . s*emental backup means backing U Diflerentian Backup incremental. Differential seems to bbe another name for increment Operations —_——. 205 an you! decry ‘and you want to see contents of ‘abe! file by using absolute path, so you can write [ate ce tile (~) will give you absolute path a /home/chris/ettersthankyou’, Same way if you na rectory & you want to see contents of fle F2 of Monday directory. So you can use tilde sign seit chs You absotute path by command ‘pw which display the present working directory . “an write $ cat ~/eports/Monday/F2, So it displays the ents of F2 Where ti oy) eaetadiied yfF2, Soit displays the contents of F2 Where tilde (~) indicates System Directories: ‘The root directory that begins with linux file structure contains several system directories. The system tory contains fils and programs used to run and maintain the system. Many directories contains ether” directories with programs for executing specific features of LINUX eg, /ustbin Contains various LINUX commands that user executes such as ep - for copy and my ~ for renaming ‘moving to other directory & the directory /bin holds interfaces with different system devices such as ter or the terminal also consist of the executable file for the commands. “ ( Backup Its always a good practice to Keep on backing up data on our computers, this can either be dane _ ually or configured to work automatically. Many backup tools have different features that allow users ‘configure the the type of backup, time of backup, what to backup, logging backup activities and many Backup is essential First a backup is essential. You need 4 good backup strategy to: OQ. Minimize time from disaster such as server failure or human error (file deleted) or acts of God Q Toavoid downtime Save money ané time OD And ultimately to save your job “— ~ ‘A backup must provide © Restrton of singleindvdual ies Restoration of file systems Mat to backup? : ‘User files and dynamic data [databases] (stored in /home or specially configured partitions or /vat et). Application software (stored OS files Application configuration files (stored in fete, ustflocal/ete or /home/user/.dotfiles) ‘Types of Backup ‘There are different kinds of backups, the following lists some of them: Full Backup Full backup means backing up everything, Incremental Backup Inctemental backup means backing up everything thet has ‘changed since last full backup. Differential Backup Differential seems tobe another name for incremental. jus) ing up we server writes them to backs Jed comm: | faewirmud ean ind command provi i, ome destination and a> sign redirect these files to tape 1 2 3 4 5. Preserve hard Links and time 6 1 8. 9, “owing epia files on a tape Dio 1B ‘devier Restoring eplo backup “Pio ive « ideviemuo | 1. Create *.cpio Archive Fite | You can create a* gio at | Sed objects | Sts le.o fled.o fted.0 51s cpio -o» > mprobjecteplo immand passes the three object len 1 end MES to opi that contains fil As seen above, the object. cpio archiv 2. Extract “cpio Archive Fite ‘pi0 extrac: To extract a given (0 -iv a5 shown below \ S mkdir output $d output 5 cpio -idv «ltmpobjectepio 3. Create *pio Archive with Selected Files > The following example creates * pio archive ly with 3nd name priate tap fleggig 4 Create *tar Archive File using cpio-F We already know bow to use the tar command effectively. * that you can also use cpio command to reat tr fi ‘ov -H tar-F sample.tar As seen above, stead of redirect the standard output you can mention the oapa mee. With the option -F 5 Extract *.tar Archive File wing cpio command You can also entra tar ile sing epiocommand as shown below, [Sepio idv -F samplestar igs as shown below? ee (ee 74.7 Compression ne 7.1.7.1 Introduction to Compressing Data: no ws The zip tility allows you to easily compres large files (th text and executable) into that take up less space. : 7 ed onfusion and chaos when tying to download files, List the fle compression utilities avilable & —o it often «ogg lt contains several file compression ilies, While this may sound great, it ofen |, unzip file, esas pee Meera “209 gfe compression uly is nc a a scan usualy instal the mae So fund n Lina sens. fyou dovnload flew pss the ile wih the uncompress shit nee (called ncompress in many Linux distributions) jb ap command COMPTESSES EVE Fein the der tat mas the wild pater, ipeapilo® vty is compatible with the popular PKZIP 2 eo ls inte Lina pag package crated by Phil Katz for MS-DOS and i ux Zipp Bae i ip ents 8 compressed file containing listed files and direcries aipeloak oreates an encrypted compress file containing listed ils and directories signote extras the comments fom a ip fi, ipsplit splits @ Zip file into smaller files of a set size (used for copying large zip files to fopn: isk) son exacts ils and directories fom a compresed ip file zp options pat] [mmddyy] (n suns (fie is) {-xilist) i ‘The default action is to add or replace zipfile entries from list, which can include the special name - ‘9 compres standard input, Af zipfile and list are omitted, zip compresses stdin to stdout. He [| shen only changed Ses up: ony changed or ne files | delete entries in zipié-m move into zpfie (delete fis | recurse into directories -j junk directory names _ |store only -| convert LF to CR LF. aut compress faster 9 compress better. uit operation -v verbose operation. ‘add one-line comments «2 ad¢ zipfile comment. read names from stdin -o make file s old a latest enty. exclude the following names i include only the following names. i Tete iy ade) Déoooadianovetin adjust self-extr ‘exe -J junk zipfile prefix (unzi fix). [1 [test apf ineprity-X eXelude eXtra file atbues. sey ‘store symbolic links as the Tink instead of the referenced file. eee eraser T |__-RTPKZiP recursion (see manual atl s fi The power of the zip utility is its bility to compress entire directories of files into a single compressed ile This makes i ideal for archiving entre directory structures: Sip +r testip test Adding: test (stored 0%) adding: testtestl/ (stored 0%) ‘adding; testtest|myprog? (stored 0%) ai ‘adding: testtestlmyprog! (stored 0%) : ‘Adding: test myprog.c (deflated 39%) ‘Adding: tesvfleS (deflated 2%) ing: teste (stored 0%) ~ ~ ny 10S adding: testtest2. (stored 0%) wt 7 28king tee. g (ord) A {cnn auddng: test ile (deflated 4%) ae adding: tesmyprog gz (stored 0%) | en | $ oir |. This example creates the zip file named testa ip, and recuses through the diestry te, seem | Mtoe cach file and directory found to the zip file, Notice fom the output that gots Ae lis| stored inthe zip file could be compressed. The {0 use foreach individual file, ‘When you use th Al of the gy | gt ip wily automatically determines the bes cane | % te hn pie a ‘cutson feature inthe zip command, files ar stored in the sume, wef Directory structure inthe 2p file Files contained in subdirectories are stored in the i, es File within the sae subdirectories. You must be ef when exacting thee the unzip co ‘The term ilrebuitd the end crestor srt inthe nw loation mat | yon? -1-72,File Compression Utility for files i: {you ar entering the fie across a NIW to save transmission time. You can efetely reine, | “ee by creating compressed copy of it. Anytime you need file again decompress it )vansm S grip mydata onti Smydata.gz drip! Yous To compress a gzip file dei S grip -d mydata.gz ‘The To decompress a gzip su S gunzip mydata.gz ML ~ Sis a S gzip 0-cmydata preface>mufiles.gz sens compressed version of a file to standard lp each fil id a 4s separately compressed extension will be g2. a -h-displays help help listing : +I file list ‘ S gzip -I myfiles.gz : + dirname ‘ + file list ~ oxtim Yu cai also zip with beipz (Burrows-wheeler block sorting text compression algorithm) The file created with extension bzz baip command compresses fie in block & enables you tsps size. S bzipz mydata > Sis mydata baz tip also created zip files: ~ SZip miydata Szip—trepons ' Sls ‘S.unzip mydatazip mydatazip A cosbiving (tar) estigg command is used to an oval hard disk tar P tans & . ahi so Sisk archive & can regagg eves MEY fey ME. ay many fle age sore eel Sle faye aa SEE HF rk hee can ex intat file are calleg the mente ees like file teas, ©. Ur file is a single file that 2 ste ne ee Persson the use, group, size a . Ores wi at Ou can archive specific es all of which ante 3. Youcan ven wee ca sect 3s originally designed to ree archives on he - em tar stands {or AP archive, yousan gn P , eate an archive Sle to hold the a ™NES O0 any device such a floppy disk ‘making backups “SS archiving is not possible in DOS only tar is used to create archiv ‘You can direct tar to archive files to. sence or file. archive (for devi oF YOU files ox combining several files into a single file for "ES on devices of files 8 specific device ot fle by usin option with he name of The syntax for the tar command with foption ‘Star option farchive name tar Directory & file name verbose mode which means that it displays detailed comments as the operation proceeds like ication ry 5 seating anew achive le i tr fie dy erate: evr fs file ie. specify the name of tar file or location wee! are saved in the fie myarch.tar Jn this example the direetory mydir & its al subdirect Tyarch.tar > name of archive to be created mydir—» directory tobe archived. - * tar evf myarch.tar mydir nydir! Tydirfreports/ ‘Mydirfreports/weather ™ydi/reports/Monday "ydirfreports/Friday ydir/mymeeting ™ydinfparty 8 Command Execution a Back up ies to tape device or archive file tar option archive name ilelist Backs up file tospecitic filo device specified a arching name, fillist, cam be filenm or directory oe Te fs [ist the names of les inanarchive ON the names of files in an archive d file toan archive taka | were archived or files not already present in archive * thy é ‘created a multiple volume archive that may be stored on several floppy drives ~ archive -um |; seves the tape archives tothe file archive name instead of the defel tape devag~ ‘when inthis option gives an archive name, the f option saves the tar archive | of that name which is specified as archive name f device-nm Saves a tar archive toa device such as floppy disk or tape /dev/i is the device ae: name For your floppy disk the default devices is held in /etc/default/tar file y Displays each filename aa itis archived | Compresses or decompresses archived files using ¢ 2i The user can extract the directories from the tae using X option. The xf option extacs file Bong archive file or device. The tar extension operation generates all subdirectories, xf option directs for to extract all the files & subdirectories form the tar files. myarch.tar fearsvtmyarchar . Mtarxvf myarch.tar pathname denotes the relative pathnames, The above command creates the root directory under the current directory if it does not already exist, “FP ls myéir! mydirlreporis mydirheports/weather mydirfreports Monday mydivkepons Friday taydir/mymeeting mydir/party ‘You can use r option to add files to an already cteated archive, The r option appends the files ott archive ° 8 tar rvf myarch.tar mydoes: “The user appends the files in the myarchsar archive, Here the diectory mydocs & is files at a the myarch tar achive. you want todo change or update tothe previously created archived, you can seu opti © rchive with an modified file, tar to.update the arc : “The tar command compares the time ofthe lst update foreach achive fle with thse in use eo hive any files that have been changed since th Foes into the archive any have been changed since they were las! secs» r¥f 0 a files in these directories are also addled tothe archive suppose mydir divesery ye Het or 3 files & you want. update tha intr 2 egyarense mya : A OL Lif, i) at hve file stored in archive tar without option Mararchive file pt se wmydatt rmydata fies are capable of preserving files info. & directory structure tars commonly used to ALLS L ‘ttl " TS | Seem full & incremented backups of disks, TS | Serer any file corrupt the chances of recovering it are higher ifit is uncompressed ta file as we TTS | Moocannot update compressed file cap | sure tritar /roottest* tars ingle! | genoving leading ‘from absolute path names in archieve a ee cm ootitest/m.c.. tr file wall not store the leading slash (it removes the slash while retrieving a file as the tar file éo rutstore the absolute filename, it restores the file with relation to your current directory & prevents accidental overwriting of original data you want abpolute path to be stored use -p (capital P) option 4-tar--absolute -paths -paths -ovf trial tar/roovitest* or -p -evftrial.tar/rootitest/* ng the absolute pathnames we can created archive filename will long names also instead of using only single character # tar ~c ~v -ftrialtar/root/user/ * ter ~create -- verbose -- file = trialtar/root/user/* Deleting files form an Archive: Use delete option Stor delete -f tria.tar tmp *tar-tvf triak.tar at me, : ‘mp will be deleted (oncatenating Tar. Archives ‘8 ~Af trial tar script.tar . hay, above command adds all contents of seripttar archive to the trialtar archive. To backup the files "cific device, snecify the device as the archive for a floppy disk, you can specify the floppy drive. Be 7 Blank floppy otherwise any data previously placed on it will be erased by this operation les, User created an archive on floppy disk in the /devifdo device devite & copies into floppy disk all Aiea all in mydic directory. * ef idevifdo mydir: “extrac: the backed. up files on the hard disk in a device te fq woragip wed ip OS YIUA SpuBUIWOS PowYD YAH SuOIsSIULAd Auoreaup/aIy afuEYD 0} Mo} (2) es sopow sy pu soupy 14, (@) Suneauo ‘soucnauip 2jdaynus‘Aroyau ‘ssue-Suonsonb Sumo OU plnoys aU ‘als 30 od vai pue sieanoRdg Wosy “9 (0% pue 749 Uo a}oU NOUS w aIAA “Ge esa Bulsn jo aBerweape ay) eg p wongip uieydyg “¢ aiydey |. suonsany ain Barua ym am y 28:12 591g di Jo uonuayya ajqissod se Da) ©} dieB saajonut uondo 2 owes om pM 2 ato amo} au non ay ssiduos oy Ayn dk | "1 Stxdwoo 0 ue no 1 “SF paatyoxe uo uo|ssoudu0d W | psou ax Kay sv antap “4 40q fun puwiuoo 20, Fumoy| 101 Koy wi mp sip Ady 3 Mu yy Ma, Ny fay ea nog “iy saw0d9q auo uy 54 gel ® 91 Buryoae wows pari "0 condo way. sjgoy Senn ay som np ane Une aoiaape wo ajgojea aq pjnom wey) aovds a10W #50 “shame un peop ut puso 20 wed _Rertn sso asp undo pur a ep Jo otssa1dws0,) $18

You might also like