You are on page 1of 6

08/08/13

Switching From Windows to Nix or a Newbie to Linux - 20 Useful Commands for Linux Newbies

20LinuxCommandsforNewbies

1.Command:ls
Thecommandlsstandsfor(ListDirectoryContents),Listthecontentsofthefolder,beitfileorfolder,fromwhichitruns.
r o o t @ t e c m i n t : ~ #l s A n d r o i d G a m e s P i c t u r e s D e s k t o p D o c u m e n t s D o w n l o a d s M u s i c P u b l i c T e c m i n t . c o m T e c M i n t S y n c T e m p l a t e s

Thecommandlsllistthecontentoffolder,inlonglistingfashion.
r o o t @ t e c m i n t : ~ #l sl t o t a l4 0 5 8 8 d r w x r w x r x2r a v i s a i v er a v i s a i v e d r w x r x r x2r a v i s a i v er a v i s a i v e d r w x r x r x2r a v i s a i v er a v i s a i v e d r w x r x r x6r a v i s a i v er a v i s a i v e d r w x r x r x2r a v i s a i v er a v i s a i v e d r w x r x r x2r a v i s a i v er a v i s a i v e d r w x r w x r x5r a v i s a i v er a v i s a i v e d r w x r x r x2r a v i s a i v er a v i s a i v e 4 0 9 6M a y 80 1 : 0 6A n d r o i dG a m e s 4 0 9 6M a y1 51 0 : 5 0D e s k t o p 4 0 9 6M a y1 61 6 : 4 5D o c u m e n t s 4 0 9 6M a y1 61 4 : 3 4D o w n l o a d s 4 0 9 6A p r3 02 0 : 5 0M u s i c 4 0 9 6M a y 91 7 : 5 4P i c t u r e s 4 0 9 6M a y 31 8 : 4 4T e c m i n t . c o m 4 0 9 6A p r3 02 0 : 5 0T e m p l a t e s

Commandlsa,listthecontentoffolder,includinghiddenfilesstartingwith..
r o o t @ t e c m i n t : ~ #l sa . . a d o b e . g s t r e a m e r 0 . 1 0 . H o t S h o t s . p r o f i l e . j e d i t . X a u t h o r i t y . g f t p . s s h . x s e s s i o n e r r o r s . o l d . g n u p g d e j a d u p . m t p a i n t . m y s q l _ h i s t o r y . b a s h _ h i s t o r y . p u l s e . g c o n f . m a c r o m e d i a . x s e s s i o n e r r o r s . c o n f i g . d b u s . g r s y n c . t h u m b n a i l s . h t a c c e s s . i c o n s . b a s h r c . l o c a l . r e m m i n a . c o m p i z . g n o m e 2 . g o u t p u t s t r e a m P I 5 V V W . m o z i l l a . g t k b o o k m a r k s . a p p o r t i g n o r e . x m l . b a s h _ l o g o u t . l i f e r e a _ 1 . 8 . X a u t h o r i t y . H G H V W W . c i n n a m o n . g n o m e . z o n c o l o r . m i s s i o n c o n t r o l . t h e m e s . t h u n d e r b i r d . I C E a u t h o r i t y . f b m e s s e n g e r . p u l s e c o o k i e . c a c h e . g i m p 2 . 8 t e a m v i e w e r _ l i n u x . d e b

Note:InLinuxfilenamestartingwith.ishidden.InLinuxeveryfile/folder/device/commandisafile.Theoutputoflslis: 1. d(standsfordirectory). 2. rwxrxrxisthefilepermissionofthefile/folderforowner,groupandworld. 3. The1stravisaiveintheaboveexamplemeansthatfileisownedbyuserravisaive. 4. The2ndravisaiveintheaboveexamplemeansfilebelongstousergroupravisaive. 5. 4096meansfilesizeis4096Bytes. 6. May801:06isthedateandtimeoflastmodification. 7. AndattheendisthenameoftheFile/Folder. Formorelscommandexamplesread15lsCommandExamplesinLinux.

2.Command:lsblk

www.tecmint.com/useful-linux-commands-for-newbies/

2/13

08/08/13

Switching From Windows to Nix or a Newbie to Linux - 20 Useful Commands for Linux Newbies

Thelsblkstandsfor(ListBlockDevices),printblockdevicesbytheirassignedname(butnotRAM)onthestandardoutputinatreelikefashion.
r o o t @ t e c m i n t : ~ #l s b l k N A M E M A J : M I NR M S I Z ER OT Y P EM O U N T P O I N T s d a 8 : 0 02 3 2 . 9 G 0d i s k s d a 1 8 : 1 0 4 6 . 6 G 0p a r t/ s d a 2 8 : 2 0 1 K 0p a r t s d a 5 8 : 5 0 1 9 0 M 0p a r t/ b o o t s d a 6 8 : 6 0 3 . 7 G 0p a r t[ S W A P ] s d a 7 8 : 7 0 9 3 . 1 G 0p a r t/ d a t a s d a 8 8 : 8 0 8 9 . 2 G 0p a r t/ p e r s o n a l s r 0 1 1 : 0 1 1 0 2 4 M 0r o m

Thelsblklcommandlistblockdevicesinliststructure(nottreelikefashion).
r o o t @ t e c m i n t : ~ #l s b l kl N A M EM A J : M I NR M S I Z ER OT Y P EM O U N T P O I N T s d a 8 : 0 02 3 2 . 9 G 0d i s k s d a 1 8 : 1 0 4 6 . 6 G 0p a r t/ s d a 2 8 : 2 0 1 K 0p a r t s d a 5 8 : 5 0 1 9 0 M 0p a r t/ b o o t s d a 6 8 : 6 0 3 . 7 G 0p a r t[ S W A P ] s d a 7 8 : 7 0 9 3 . 1 G 0p a r t/ d a t a s d a 8 8 : 8 0 8 9 . 2 G 0p a r t/ p e r s o n a l s r 0 1 1 : 0 1 1 0 2 4 M 0r o m

Note:lsblkisveryusefulandeasiestwaytoknowthenameofNewUsbDeviceyoujustpluggedin,especiallywhenyouhavetodealwithdisk/blocks interminal.

3.Command:md5sum
Themd5sumstandsfor(ComputeandCheckMD5MessageDigest),md5checksum(commonlycalledhash)isusedtomatchorverifyintegrity offilesthatmayhavechangedasaresultofafaultyfiletransfer,adiskerrorornonmaliciousinterference.
r o o t @ t e c m i n t : ~ #m d 5 s u mt e a m v i e w e r _ l i n u x . d e b 4 7 7 9 0 e d 3 4 5 a 7 b 7 9 7 0 f c 1 f 2 a c 5 0 c 9 7 0 0 2 t e a m v i e w e r _ l i n u x . d e b

Note:Theusercanmatchthegeneratedmd5sumwiththeoneprovidedofficially.Md5sumisconsideredlesssecurethansha1sum,whichwewill discusslater.

4.Command:dd
Commandddstandsfor(ConvertandCopyafile),Canbeusedtoconvertandcopyafileandmostofthetimesisusedtocopyaisofile(orany otherfile)toausbdevice(oranyotherlocation),thuscanbeusedtomakeaBootlableUsbStick.
r o o t @ t e c m i n t : ~ #d di f = / h o m e / u s e r / D o w n l o a d s / d e b i a n . i s oo f = / d e v / s d b 1b s = 5 1 2 M ;s y n c

Note:Intheaboveexampletheusbdeviceissupposedtobesdb1(YoushouldVerifyitusingcommandlsblk,otherwiseyouwilloverwriteyourdisk andOS),usenameofdiskveryCautiously!!!. ddcommandtakessometimerangingfromafewsecondstoseveralminutesinexecution,dependingonthesizeandtypeoffileandreadandwrite speedofUsbstick.

5.Command:uname
Theunamecommandstandsfor(UnixName),printdetailedinformationaboutthemachinename,OperatingSystemandKernel.
r o o t @ t e c m i n t : ~ #u n a m ea L i n u xt e c m i n t3 . 8 . 0 1 9 g e n e r i c# 3 0 U b u n t uS M PW e dM a y11 6 : 3 6 : 1 3U T C2 0 1 3i 6 8 6i 6 8 6i 6 8 6G N U / L i n u x

Note:unameshowstypeofkernel.unameaoutputdetailedinformation.Elaboratingtheaboveoutputofunamea. 1. Linux:Themachineskernelname. 2. tecmint:Themachinesnodename. 3. 3.8.019generic:Thekernelrelease. 4. #30UbuntuSMP:Thekernelversion. 5. i686:Thearchitectureoftheprocessor. 6. GNU/Linux:Theoperatingsystemname.

6.Command:history
ThehistorycommandstandsforHistory(Event)Record,itprintsthehistoryoflonglistofexecutedcommandsinterminal.
r o o t @ t e c m i n t : ~ #h i s t o r y 1 s u d oa d d a p t r e p o s i t o r yp p a : t u a l a t r i x / p p a 2 s u d oa p t g e tu p d a t e 3 s u d oa p t g e ti n s t a l lu b u n t u t w e a k

www.tecmint.com/useful-linux-commands-for-newbies/

3/13

08/08/13

Switching From Windows to Nix or a Newbie to Linux - 20 Useful Commands for Linux Newbies

4 s u d oa d d a p t r e p o s i t o r yp p a : d i e s c h / t e s t i n g 5 s u d oa p t g e tu p d a t e 6 s u d oa p t g e ti n s t a l li n d i c a t o r p r i v a c y 7 s u d oa d d a p t r e p o s i t o r yp p a : a t a r e a o / a t a r e a o 8 s u d oa p t g e tu p d a t e 9 s u d oa p t g e ti n s t a l lm y w e a t h e r i n d i c a t o r 1 0p w d 1 1c d& &s u d oc pru n i t y / 6/ u s r / s h a r e / u n i t y / 1 2c d/ u s r / s h a r e / u n i t y / i c o n s / 1 3c d/ u s r / s h a r e / u n i t y

Note:PressingCtrl+Randthensearchforalreadyexecutedcommandswhichletsyourcommandtobecompletedwithautocompletionfeature.
( r e v e r s e i s e a r c h ) ` i f ' :i f c o n f i g

7.Command:sudo
Thesudo(superuserdo)commandallowsapermittedusertoexecuteacommandasthesuperuseroranotheruser,asspecifiedbythesecurity policyinthesudoerslist.
r o o t @ t e c m i n t : ~ #s u d oa d d a p t r e p o s i t o r yp p a : t u a l a t r i x / p p a

Note:sudoallowsusertoborrowsuperuserprivileged,whileasimilarcommandsuallowsusertoactuallyloginassuperuser.Sudoissaferthansu. Itisnotadvisedtousesudoorsufordaytodaynormaluse,asitcanresultinseriouserrorifaccidentallyyoudidsomethingwrong,thatswhyavery popularsayinginLinuxcommunityis:


T oe r ri sh u m a n ,b u tt or e a l l yf o u lu pe v e r y t h i n g ,y o un e e dr o o tp a s s w o r d .

8.Command:mkdir
Themkdir(Makedirectory)commandcreateanewdirectorywithnamepath.Howeveristhedirectoryalreadyexists,itwillreturnanerrormessage cannotcreatefolder,folderalreadyexists.
r o o t @ t e c m i n t : ~ #m k d i rt e c m i n t

Note:Directorycanonlybecreatedinsidethefolder,inwhichtheuserhaswritepermission.mkdir:cannotcreatedirectory`tecmint:Fileexists (Dontconfusewithfileintheaboveoutput,youmightrememberwhatisaidatthebeginningInLinuxeveryfile,folder,drive,command,scriptsare treatedasfile).

9.Command:touch
Thetouchcommandstandsfor(UpdatetheaccessandmodificationtimesofeachFILEtothecurrenttime).touchcommandcreatesthefile,onlyifit doesntexist.Ifthefilealreadyexistsitwillupdatethetimestampandnotthecontentsofthefile.
r o o t @ t e c m i n t : ~ #t o u c ht e c m i n t f i l e

Note:touchcanbeusedtocreatefileunderdirectory,onwhichtheuserhaswritepermission,onlyifthefiledontexistthere.

10.Command:chmod
TheLinuxchmodcommandstandsfor(changefilemodebits).chmodchangesthefilemode(permission)ofeachgivenfile,folder,script,etc.. accordingtomodeaskedfor. Thereexist3typesofpermissiononafile(folderoranythingbuttokeepthingssimplewewillbeusingfile).
R e a d( r ) = 4 W r i t e ( w ) = 2 E x e c u t e ( x ) = 1

Soifyouwanttogiveonlyreadpermissiononafileitwillbeassignedavalueof4,forwritepermissiononly,avalueof2andforexecute permissiononly,avalueof1istobegiven.Forreadandwritepermission4+2=6istobegiven,anssoon. Nowpermissionneedtobesetfor3kindsofuserandusergroup.Thefirstisowner,thenusergroupandfinallyworld.


r w x r x x a b c . s h

Heretherootspermissionisrwx(read,writeandexecute). usergrouptowhichitbelongs,isrx(readandexecuteonly,nowritepermission)and forworldisx(onlyexecute). Tochangeitspermissionandprovideread,writeandexecutepermissiontoowner,groupandworld.


r o o t @ t e c m i n t : ~ #c h m o d7 7 7a b c . s h

onlyreadandwritepermissiontoallthree.
r o o t @ t e c m i n t : ~ #c h m o d6 6 6a b c . s h

read,writeandexecutetoownerandonlyexecutetogroupandworld.

www.tecmint.com/useful-linux-commands-for-newbies/

4/13

08/08/13

Switching From Windows to Nix or a Newbie to Linux - 20 Useful Commands for Linux Newbies

r o o t @ t e c m i n t : ~ #c h m o d7 1 1a b c . s h

Note:oneofthemostimportantcommandusefulforsysadminanduserboth.Onamultiuserenvironmentoronaserver,thiscommandcomesto rescue,settingwrongpermissionwilleithermakesafileinaccessibleorprovideunauthorizedaccesstosomeone.

11.Command:chown
TheLinuxchowncommandstandsfor(changefileownerandgroup).Everyfilebelongstoagroupofuserandaowner.ItisusedDolslinto yourdirectoryandyouwillseesomethinglikethis.
r o o t @ t e c m i n t : ~ #l sl d r w x r x r x3s e r v e rr o o t4 0 9 6M a y1 01 1 : 1 4B i n a r y d r w x r x r x2s e r v e rs e r v e r4 0 9 6M a y1 30 9 : 4 2D e s k t o p

HerethedirectoryBinaryisownedbyuserserveranditbelongstousergrouprootwhereasdirectoryDesktopisownedbyuserserverand belongstousergroupserver. Thischowncommandisusedtochangethefileownershipandthusisusefulinmanagingandprovidingfiletoauthoriseduserandusergrouponly.


r o o t @ t e c m i n t : ~ #c h o w ns e r v e r : s e r v e rB i n a r y d r w x r x r x3s e r v e rs e r v e r4 0 9 6M a y1 01 1 : 1 4B i n a r y d r w x r x r x2s e r v e rs e r v e r4 0 9 6M a y1 30 9 : 4 2D e s k t o p

Note:chownchangestheuserandgroupownershipofeachgivenFILEtoNEWOWNERortotheuserandgroupofanexistingreferencefile.

12.Command:apt
TheDebianbasedaptcommandstandsfor(AdvancedPackageTool).AptisanadvancedpackagemanagerforDebianbasedsystem(Ubuntu, Kubuntu,etc.),thatautomaticallyandintelligentlysearch,install,updateandresolvesdependencyofpackagesonGnu/Linuxsystemfrom commandline.
r o o t @ t e c m i n t : ~ #a p t g e ti n s t a l lm p l a y e r R e a d i n gp a c k a g el i s t s . . .D o n e B u i l d i n gd e p e n d e n c yt r e e R e a d i n gs t a t ei n f o r m a t i o n . . .D o n e T h ef o l l o w i n gp a c k a g ew a sa u t o m a t i c a l l yi n s t a l l e da n di sn ol o n g e rr e q u i r e d : j a v a w r a p p e r s U s e' a p t g e ta u t o r e m o v e 't or e m o v ei t . T h ef o l l o w i n ge x t r ap a c k a g e sw i l lb ei n s t a l l e d : e s o u n d c o m m o nl i b a u d i o f i l e 1l i b e s d 0l i b o p e n a l d a t al i b o p e n a l 1l i b s v g a 1l i b v d p a u 1l i b x v i d c o r e 4 S u g g e s t e dp a c k a g e s : p u l s e a u d i o e s o u n d c o m p a tl i b r o a r c o m p a t 2n v i d i a v d p a u d r i v e rv d p a u d r i v e rm p l a y e r d o cn e t s e l e c tf p i n g T h ef o l l o w i n gN E Wp a c k a g e sw i l lb ei n s t a l l e d : e s o u n d c o m m o nl i b a u d i o f i l e 1l i b e s d 0l i b o p e n a l d a t al i b o p e n a l 1l i b s v g a 1l i b v d p a u 1l i b x v i d c o r e 4m p l a y e r 0u p g r a d e d ,9n e w l yi n s t a l l e d ,0t or e m o v ea n d8n o tu p g r a d e d . N e e dt og e t3 , 5 6 7k Bo fa r c h i v e s . A f t e rt h i so p e r a t i o n ,7 , 7 7 2k Bo fa d d i t i o n a ld i s ks p a c ew i l lb eu s e d . D oy o uw a n tt oc o n t i n u e[ Y / n ] ?y r o o t @ t e c m i n t : ~ #a p t g e tu p d a t e H i th t t p : / / p p a . l a u n c h p a d . n e tr a r i n gR e l e a s e . g p g H i th t t p : / / p p a . l a u n c h p a d . n e tr a r i n gR e l e a s e . g p g H i th t t p : / / p p a . l a u n c h p a d . n e tr a r i n gR e l e a s e . g p g H i th t t p : / / p p a . l a u n c h p a d . n e tr a r i n gR e l e a s e . g p g G e t : 1h t t p : / / s e c u r i t y . u b u n t u . c o mr a r i n g s e c u r i t yR e l e a s e . g p g[ 9 3 3B ] H i th t t p : / / i n . a r c h i v e . u b u n t u . c o mr a r i n gR e l e a s e . g p g H i th t t p : / / p p a . l a u n c h p a d . n e tr a r i n gR e l e a s e . g p g G e t : 2h t t p : / / s e c u r i t y . u b u n t u . c o mr a r i n g s e c u r i t yR e l e a s e[ 4 0 . 8k B ] I g nh t t p : / / p p a . l a u n c h p a d . n e tr a r i n gR e l e a s e . g p g G e t : 3h t t p : / / i n . a r c h i v e . u b u n t u . c o mr a r i n g u p d a t e sR e l e a s e . g p g[ 9 3 3B ] H i th t t p : / / p p a . l a u n c h p a d . n e tr a r i n gR e l e a s e . g p g H i th t t p : / / i n . a r c h i v e . u b u n t u . c o mr a r i n g b a c k p o r t sR e l e a s e . g p g

Note:Theabovecommandsresultsintosystemwidechangesandhencerequiresrootpassword(Check#andnot$asprompt).Aptisconsidered moreadvancedandintelligentascomparedtoyumcommand. Asthenamesuggest,aptcachesearchforpackagecontainingsubpackagempalyer.aptgetinstall,updateallthepackages,thatarealreadyinstalled, tothenewestone. Readmoreaboutaptgetandaptcachecommandsat25APTGETandAPTCACHECommands

13.Command:tar
ThetarcommandisaTapeArchiveisusefulincreationofarchive,inanumberoffileformatandtheirextraction.
r o o t @ t e c m i n t : ~ #t a rz x v fa b c . t a r . g z( R e m e m b e r' z 'f o r. t a r . g z ) r o o t @ t e c m i n t : ~ #t a rj x v fa b c . t a r . b z 2( R e m e m b e r' j 'f o r. t a r . b z 2 ) r o o t @ t e c m i n t : ~ #t a rc v fa r c h i e v e . t a r . g z ( . b z 2 )/ p a t h / t o / f o l d e r / a b c

Note:Atar.gzmeansgzipped.tar.bz2iscompressedwithbzipwhichusesabetterbutslowercompressionmethod.

www.tecmint.com/useful-linux-commands-for-newbies/

5/13

08/08/13

Switching From Windows to Nix or a Newbie to Linux - 20 Useful Commands for Linux Newbies

Readmoreabouttarcommandexamplesat18TarCommandExamples

14.Command:cal
Thecal(Calendar),itisusedtodisplayscalendarofthepresentmonthoranyothermonthofanyyearthatisadvancingorpassed.
r o o t @ t e c m i n t : ~ #c a l M a y2 0 1 3 S uM oT uW eT hF rS a 1 2 3 4 5 6 7 8 91 01 1 1 21 31 41 51 61 71 8 1 92 02 12 22 32 42 5 2 62 72 82 93 03 1

Showcalendarofyear1835formonthFebruary,thatalreadyhaspassed.
r o o t @ t e c m i n t : ~ #c a l0 21 8 3 5 F e b r u a r y1 8 3 5 S uM oT uW eT hF rS a 1 2 3 4 5 6 7 8 91 01 11 21 31 4 1 51 61 71 81 92 02 1 2 22 32 42 52 62 72 8

Showscalendarofyear2145forthemonthofJuly,thatwilladvancing
r o o t @ t e c m i n t : ~ #c a l0 72 1 4 5 J u l y2 1 4 5 S uM oT uW eT hF rS a 1 2 3 4 5 6 7 8 91 0 1 11 21 31 41 51 61 7 1 81 92 02 12 22 32 4 2 52 62 72 82 93 03 1

Note:Youneednottoturnthecalendarof50yearsback,neitheryouneedtomakecomplexmathematicalcalculationtoknowwhatdayyouwereworn oryourcomingbirthdaywillfallonwhichday.

15.Command:date
Thedate(Date)commandprintthecurrentdateandtimeonthestandardoutput,andcanfurtherbeset.
r o o t @ t e c m i n t : ~ #d a t e F r iM a y1 71 4 : 1 3 : 2 9I S T2 0 1 3 r o o t @ t e c m i n t : ~ #d a t es e t = ' 1 4m a y2 0 1 31 3 : 5 7 ' M o nM a y1 31 3 : 5 7 : 0 0I S T2 0 1 3

Note:ThisCommandwillbeveryusefullinscripting,timeanddatebasedscripting,tobemoreperfect.Moreoverchangingdateandtimeusing terminalwillmakeyoufeelGEEK!!!.(Obviouslyyouneedtoberoottoperformthisoperation,asitisasystemwidechange).

16.Command:cat
Thecatstandsfor(Concatenation).Concatenate(join)twoormoreplainfileand/orprintcontentsofafileonstandardoutput.
r o o t @ t e c m i n t : ~ #c a ta . t x tb . t x tc . t x td . t x ta b c d . t x t r o o t @ t e c m i n t : ~ #c a ta b c d . t x t . . . . c o n t e n t so ff i l ea b c d . . .

Note:>>and>arecalledappendsymbol.Theyareusedtoappendtheoutputtoafileandnotonstandardoutput.>symbolwilldeleteafile alreadyexistedandcreateanewfilehenceforsecurityreasonitisadvisedtouse>>thatwillwritetheoutputwithoutoverwritingordeletingthefile. BeforeProceedingfurther,Imustletyouknowaboutwildcards(youwouldbeawareofwildcardentry,inmostoftheTelevisionshows)Wildcardsare ashellfeaturethatmakesthecommandlinemuchmorepowerfulthananyGUIfilemanagers.Yousee,ifyouwanttoselectabiggroupoffilesina graphicalfilemanager,youusuallyhavetoselectthemwithyourmouse.Thismayseemsimple,butinsomecasesitcanbeveryfrustrating. Forexample,supposeyouhaveadirectorywithahugeamountofallkindsoffilesandsubdirectories,andyoudecidetomovealltheHTMLfiles,that havethewordLinuxsomewhereinthemiddleoftheirnames,fromthatbigdirectoryintoanotherdirectory.Whatsasimplewaytodothis?Ifthe directorycontainsahugeamountofdifferentlynamedHTMLfiles,yourtaskiseverythingbutsimple! IntheLinuxCLIthattaskisjustassimpletoperformasmovingonlyoneHTMLfile,anditssoeasybecauseoftheshellwildcards.Thesearespecial charactersthatallowyoutoselectfilenamesthatmatchcertainpatternsofcharacters.Thishelpsyoutoselectevenabiggroupoffileswithtypingjusta fewcharacters,andinmostcasesitseasierthanselectingthefileswithamouse. Heresalistofthemostcommonlyusedwildcards:

www.tecmint.com/useful-linux-commands-for-newbies/

6/13

08/08/13
W i l d c a r d * ? [ a b c d e ] [ a e ] [ ! a b c d e ] [ ! a e ] { d e b i a n , l i n u x }

Switching From Windows to Nix or a Newbie to Linux - 20 Useful Commands for Linux Newbies
M a t c h e s z e r oo rm o r ec h a r a c t e r s e x a c t l yo n ec h a r a c t e r e x a c t l yo n ec h a r a c t e rl i s t e d e x a c t l yo n ec h a r a c t e ri nt h eg i v e nr a n g e a n yc h a r a c t e rt h a ti sn o tl i s t e d a n yc h a r a c t e rt h a ti sn o ti nt h eg i v e nr a n g e e x a c t l yo n ee n t i r ew o r di nt h eo p t i o n sg i v e n

!iscallednotsymbol,andthereverseofstringattachedwith!istrue. ReadmoreexamplesofLinuxcatcommandat13CatCommandExamplesinLinux

17.Command:cp
Thecopystandsfor(Copy),itcopiesafilefromonelocationtoanotherlocation.
r o o t @ t e c m i n t : ~ #c p/ h o m e / u s e r / D o w n l o a d sa b c . t a r . g z/ h o m e / u s e r / D e s k t o p( R e t u r n0w h e ns u c e s s )

Note:cpisoneofthemostcommonlyusedcommandinshellscriptinganditcanbeusedwithwildcardcharacters(Describeintheaboveblock),for customisedanddesiredfilecopying.

18.Command:mv
Themvcommandmovesafilefromonelocationtoanotherlocation.
r o o t @ t e c m i n t : ~ #m v/ h o m e / u s e r / D o w n l o a d sa b c . t a r . g z/ h o m e / u s e r / D e s k t o p( R e t u r n0w h e ns u c e s s )

Note:mvcommandcanbeusedwithwildcardcharacters.mvshouldbeusedwithcaution,asmovingofsystem/unauthorisedfilemayleadtosecurity aswellasbreakdownofsystem.

19.Command:pwd
Thecommandpwd(printworkingdirectory),printsthecurrentworkingdirectorywithfullpathnamefromterminal.
r o o t @ t e c m i n t : ~ #p w d / h o m e / u s e r / D e s k t o p

Note:Thiscommandwontbemuchfrequentlyusedinscriptingbutitisanabsolutelifesaverfornewbiewhogetslostinterminalintheirearly connectionwithnux.(Linuxismostcommonlyreferredasnuxornix).

20.Command:cd
Finally,thefrequentlyusedcdcommandstandsfor(changedirectory),itchangetheworkingdirectorytoexecute,copy,movewrite,read,etc.from terminalitself.
r o o t @ t e c m i n t : ~ #c d/ h o m e / u s e r / D e s k t o p s e r v e r @ l o c a l h o s t : ~ $p w d / h o m e / u s e r / D e s k t o p

Note:cdcomestorescuewhenswitchingbetweendirectoriesfromterminal.Cd~willchangetheworkingdirectorytousershomedirectory,andis veryusefulifauserfindshimselflostinterminal.Cd..willchangetheworkingdirectorytoparentdirectory(ofcurrentworkingdirectory). ThesecommandswillsurelymakeyoucomfortablewithLinux.Butitsnottheend.VerysoonIwillbecomingwithothercommandswhichwillbe usefulforMiddleLevelUseri.e.,You!Nodontexclaim,ifyougetusedtothesecommands,Youwillnoticepromotioninuserlevelfromnewbie toMiddleleveluser.Inthenextarticle,IwillbecomingupwithcommandslikeKill,Ps,grep,.WaitforthearticleandIdontwanttospoil yourinterest.

Bio

LatestPosts

Avishek Kumar
Iamamajorincomputerscience,lovetoresearchnix.Ilovetowritecodesandscripts,reviewdistros,experimentFoss Technologies,writetechnicalarticles,Hack,ofcourseEthically.IamworkingasSystemAdministrator(nix)foraNGO.

GNULinux

4Linux

InLinux

LearnLinux

www.tecmint.com/useful-linux-commands-for-newbies/

7/13

You might also like