Basic Commands

You might also like

Download as pdf
Download as pdf
You are on page 1of 7
: ® “STRATEGIC NETWORK SOLUTIONS \mrooccrns sy PAT OF Mus COURSE Mare. WITHOUT ERIOR WRETEN CONSENT OF STRATEIC NETWORK SOLITONS IS THE Y43TI0N OF LAWALL SRSGRSVED, Stair ACTON WUD BE Tae hy PEXGON Poene VT TS} Basic Linux Commands 1) pwas print working directory. The pwd command dapays the complete path of he cutrent dectery from {/) root ofthe Mle system. ‘Syntax: Sond 2) mie} The midi command is used to create ene or more directories or 8 comple iesory structure, ou can use the follwing options with mle “Bs parents 9 erent parent lector ws neadee WV, shetbose 3 displays message ns denies ae create, ‘Syntax: sinkdir 3) ed You car ose of command to change to specifi directory Ifyou want to move Back tothe parent directory You have 2 use wlth cd commend ‘Symans 4 4) vet one command i see cteate emotes, Ths crm is aso edt med he last mdifeation Se ees or directories Syntan:$ touch ‘You ear sue the fllning options withthe teueh command > erangeaniy the access time <9 change only moaieatin tne 5) cat cat command js used to se te contents ofthe fe. The et command ls ured to crate ne ies, overwrite existing fl or append Some tent a exiting fies You have to use any ofthe folly fedrectng syrmbls, Syntax: $ eat >aiplay the contents Seat > cflename> > to cmate 8 overt lag Seat 3> cllename> 9 to create Bappend Mes > 2 overwaitereauector 2. 3 tppend reaecor ‘Once ou ute any of the rediectors with cat comma’ you can save the contents tothe le by pressing Ctl 4) {3e: This corpmand works exaly le the cat command ence Sisayed os fst, the contents of the ASCH il In reverse order, ast ine wl be syntas: $46 n lo: The file command displays the filetype of 3 padicuar or spaifed file n UNIX wverything is rested as 2 fi, Some of he Sle ty ‘sora! es ahectoresdovee fle, sumed pipe, rocket fies symbole ks Syntax: $e ) Lee command i wed to lt ile & drctrias. Vatous options that can be used with Is command Syntees $6 Lineal les 6 directories including den but excluding current directory link () and patent rectory lnk.) 4-9 don't decent nto directory = easily > appends an iadicator atthe end ofthe fle STRATEGIC NETWORK SOLUTIONS . (ovorgcopung an 9487 OF Ws COURSE MATERIAL THOUT P10R WRITTEN CONSENT OF STRATEGIC NETWORK SOLUTIONS 1 THE VIGLATION OF LAW AL AigSTERESENeD Suc ACTON WcLAB Tc An PERSON POUR UCLA 8) {> dlectorne 22 mbt 3 Binary oF execu 1 onan ‘Ses hy human-readable > print sizes ofthe ile in human readable forma. Thi option fas to be used with is --inode > priate the inode no of eh fil, Inade i the index Node ie # addres location in the dk wh store, option si hele attributes a “1 Lists es 8 directories in long format. By using this option it shows seven atibutes of Ret 1 otal fe, lesymbli ink, bboek device 2 3 4: Ohner user 5 é z ‘char deve file) Bre group reverue > lee the fis in descend order Ry ~ recursive + Recursively ist complete aretary structure “5-9 dopey size in bios (etal ie 4.8.4 Blocks oft Kb each) 9) dirt Te ar comman is use to it he dlsctories& file of the System. You can woe alos al the options of thee cemmans. Syntar: $e 10) rma Ty ed command is used 2 romeve directory ofa complat dretery structure, The vnc command ean only remove emty Diectavies You can use the following optons with mal command Syntax: $emdie removes parent aitectory 35 needed ov, ~verbone > displays message verbosely remove fies and arectris from the system, Without any options you ean nly remove Hes. The Slowing options san be used yh te rm comma ‘Scan: $m ‘You can use the fllolng options with the em command tpR > eecrevaly comoves directay & ts contants | ath for cenfemation afore deleting {> foray removes fle 8 dvetries and doesn't cisplay ator messnges for files that don't exis, “42 diablays message verbesly 12) eps ep cornmand i usd t capy fies & directories fom are lation to another By default without any options you can epy ony les sth cp command Ifyou want to copy directory you have te ura =r option. By delautifstnation alfeasy contains the same Fe Ril {et overwritten withthe source witout couformation To make system ask fr Conforaiion You can use“ oDbon Syntan: $e You ean use the lowing eptions withthe ep command for entiemation belore overwriting ty recursive > Recursivaly copes directory structure. 4, force > forcibly copes Fs and drectores verbose > dplys verbore messages interactive 9 hides err messages if fee and dir are non STRATEGIC NETWORK SOLUTIONS (ev rocarrns sy PART OF HS COURSE MATERIAL W: TOUT PRIOR WRITTEN CONSENT OF STRATEGIC NETWORK SOLUTIONS ISTHE VICLATION OF LW LL ISAT Rasen STRICT SCLOW WCU BE Teen ANY PERSCNFOAMD CATING HS) Ee ee plan te move th 13) mvt The mv commane ie used to move ies & decories from one locaton to another unlike cp cammang my does ot ceguire any re directs. However You can use =| option withthe mv command ta Interactive Remember my command is asa used to Re the mv commane same fe and directories Sytan: mv «esti ask for confirmation Befare overwriting Sy Averbose'> diplys verbore messages 134) more: mote commans is wsed &0 see the contents ofa file oF output, page (arot scl Sacard Syntax: $ ma Vine. wige, The deanback of hie command ie that you filename 19 + less commant ig uted to eee the cantante of 3 fle oF out, page-wise a ine-yie. Advan cated that uring ts cereaand you can alvaye sol back & fh. Syntax: sess 1 ofthe less command over more -flenare> 16) hond + The head command by default splays the ist 10 lines ofthe fl Syntax: shead “You cam ato specly the numberof ines you want to see 50 of lines> ita + Thetall command by default dlapaye the lst 10 lines ofthe ‘syntax: sti You cam also specty the num wna oflines> -flename> a nes you want to see 18) Isp the interactive spalling checking utlity which sar advanced th (Unie ispel not only points eut the speling mistakes but also a replace 13 ‘Syntax: sspll that of orginal Unix spel uit, Unlike pal utity of fethe word, oryou can add it tothe dictionary. 19) login: Tis command wil presente loain prompt ‘syntax sogin 20) mare The man command diplays the online manual pages of the specified command ‘syntax: $man ceommand- 21) Info: The info command depays the information pages ef the specified command, If there are no info pages avallabie manus! pages il be esplayed Syntax: $ifo 22) history The history command displays lat thousand commands executed on the system, Syntax: # history ‘ou can use the flloning options with the history command 9 displays commands (2 dara the tory bull 23) cal cal command dgplays the calendar, You ean use the folowing options with thecal command Syntxs feat As aplys the calendar ofthe current month (deal) a 1 apays the ealendar of the previous, current, & next month, Te Gaplaye Sunday athe it day of te reek (eft) nt daplys Monday 25 the ist day ofthe meek. Pi aepiays enlensar using July date VF splays calendar ofthe carrenk ear. STRATEGIC NETWORK SOLUTIONS ' SCOTS VR a St RI SRR SR i roe oun wonon ra 24) date date command ie used to view or st the dete B te of system. Tis comenand affect the eytamn SIOS ae rebosting Example: § date wmODKhmmyYyy 88 o> mney (2-42) DO > date (2-33) be roure (00-23) rm") minutes (00-59) ‘yyy year (1970-2038) 3 “seconds (00 58) 25) ty & The ty command shows the device filename to which ctrent terminal is asocited Synan: $y to diferent user, 26) nu The aa command ie sed to temperaly chan Syma eu 27) echo : The echo commans is uted to dapay stngson the screen ora Shel sap en fs with small texts, Ths command is eneraly used in Syntax: $ cho ceptions» “string” enable back {3 Bacsiaen (23 Alert Ball \n 9 newline 9 Horizontal Tab Wo Vertical Tab hed eecapa character forthe following escape characters 28) uptime : The uptie command shows the date and tie sine the systems up. This command als displays average ead of cpu since EATS min and there oF vere carverty contecd othe system Sar ymax: $upime 28) users ; This command shows te names of the currently logged in users, ‘Symtx: Suse. 30) groups: This conmane laste nares ofl the roupe (elma grou seco FY 9roupe) ofthe user who has executed 231) clear The clear command Syntax: § clear 32) hostname : The hostname command displays the hostname configured forthe ayatem. A Rostname consist of «hostname plus domain Syntax: § hestrame 33) id: Th id command prints the username, grouprame and respective uid and gid. Batically ths command prints the token which s shied to the user by the eyster after sucearsful suentieaion Synten: $8 134) who The whe commané capays the following deals ofthe users whe are curently connected, username, terminal to which they are fonnected, gate time since they are logged Syntax: $ whe ‘You can ute the folowing apions with the who comman. Heading» sieplaye the Reading foreach cele idle prints tre le tne count print the no of users cur 1 raneve © print ty oases current run level 135) w The drawbacl af the wh command is that it doesnt dsplay the current running process but the w command displays the details of iho and uptime command ante earranty running process of every provers Syntax: $w ‘STRATEGIC NETWORK SOLUTIONS: (frTocgpan any net oF Ts COURSE WATERIA WTOUT PRIOR WRITTEN CONSENT OF STRATEGIC NETWORK SOLLTIONS 1S THE VIOLATION OF LAW AL ISHS ted. Stier ACTION WOXMD 8 TAFE Tr 0 PERSON FOUND VIOLATE TH) eee 26) whoami : This command displays the dels about the user who has executed the command, Syntax: § whoams 137) whats The whavs command ssplays on ine desrpton ofthe specifi command. (execute frst as 4 root user, makewhatis command) Syntax: § whats 138) which: The whieh command assays the complete absolute path fr parila comman. ‘Synane $ which 138) we: The we command cisplays the byte, lines and characters of file you can use the fling options with °we" command ‘Symax $e days ago ype (0) slat He fis of type xx canbe the fllowing f arinary fies fe erect symlinks 1 aaekat les bo SMectdeice nes sinks (finds the files Naving number of hard rks user (ud/username:= find the Files owned by spcieduld/usemame, grou (ce/aroupnamej find the files owned by specified sl/aroupname. name (lena) tnds the les wth its mare, you can use al wieards with the flename Iname > cree sensitive manner searches rehes using inode number perm uerwager,o=r-> searches files with specie access permicsone ine > searches les with n no of Blocks cmandepth > execater the command tl dcetory levels, :~ Following action can be used with “ind” print > prints the output on the screen TES aiaply the ofp by exerting “i” command. “ovec rnde(}\ 9 eaeeites the cema> command én the output fern nthe ls provides as arguments in “grep command” ané displays the 449) grap = The rep command seazches for 2 specified sting Tine which contains the string pattern ‘Syntax: $ grep * STRATEGIC NETWORK SOLUTIONS. {rvoTocorring ANY PARE Gf 1s COURSE MATERA. WITACUT PRIOR WITTEN CONSENT CF STRATEGIC NETWORK SCLUTION 1 THE VOLATEON OF La AL You can usefollowing options with aep options: i, lanom case Ignores case snstvty rn, =line-numbere > Prefix each line withthe ine num c.count > Suppress naemal output, instead print acount of matching line foreach Input le + Relative path & Absolute Path LUND« system has hlerareical le system. Thare willbe only one coot Al ether devices such a5 cds, pe eves & other dives ae reprorerted at diecoris unger the fet Ite very Important to understand Ua concept of rearing fo the fee & ores at pare locstion There ate twa methods though whic you Wl fertile ite system ‘Absolute Path [Absolte path always tate fom the top of the fe system Le /-Momatter where your current oeaion fe |oeateg, path wil always start fom eata/enated/roiect mnvedrom root of the ile sytem Relative Path ring to files & dirctors. Gut you have not used clative path corey tat can highly s path wil avaye stant fom current sirery ot parent iectorylneaon (OF) Toese Kinds ser Some times a elative path i ls used! when Inpct tothe usage af he commend. Ae ‘cr paths are ormaly uscd wiere the referral iactoryo¢ file lore amy the current Example data/project/ share pbiedevlop network datapuble shared + Meta characters Shells wildeards +s Matches any number of character inclucing rome Matzhes a single character. {ye}: Matches» single character which Is aiter J ork {tik Matches» ingle character which snot sehar bea

You might also like