Sei sulla pagina 1di 22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Menu
Home
FreeeBook
StartHere
Contact
About

50MostFrequentlyUsedUNIX/Linux
Commands(WithExamples)
byRameshNatarajanonNovember8,2010
333

Like

573

Tweet

391

Thisarticleprovidespracticalexamplesfor50most
frequentlyusedcommandsinLinux/UNIX.
Thisisnotacomprehensivelistbyanymeans,butthisshouldgiveyouajumpstartonsomeofthe
commonLinuxcommands.Bookmarkthisarticleforyourfuturereference.
DidImissanyfrequentlyusedLinuxcommands?Leaveacommentandletmeknow.

1.tarcommandexamples
Createanewtararchive.
$tarcvfarchive_name.tardirname/

Extractfromanexistingtararchive.
$tarxvfarchive_name.tar

Viewanexistingtararchive.
$tartvfarchive_name.tar
http://www.thegeekstuff.com/2010/11/50linuxcommands/

1/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Moretarexamples:TheUltimateTarCommandTutorialwith10PracticalExamples

2.grepcommandexamples
Searchforagivenstringinafile(caseinsensitivesearch).
$grepi"the"demo_file

Printthematchedline,alongwiththe3linesafterit.
$grepA3i"example"demo_text

Searchforagivenstringinallfilesrecursively
$grepr"ramesh"*

Moregrepexamples:GetaGripontheGrep!15PracticalGrepCommandExamples

3.findcommandexamples
Findfilesusingfilename(caseinsensitvefind)
#findiname"MyCProgram.c"

Executecommandsonfilesfoundbythefindcommand
$findiname"MyCProgram.c"execmd5sum{}\;

Findallemptyfilesinhomedirectory
#find~empty

Morefindexamples:Mommy,Ifoundit!15PracticalLinuxFindCommandExamples

4.sshcommandexamples
Logintoremotehost
sshljsmithremotehost.example.com

Debugsshclient
sshvljsmithremotehost.example.com

Displaysshclientversion
$sshV
OpenSSH_3.9p1,OpenSSL0.9.7aFeb192003

Moresshexamples:5BasicLinuxSSHClientCommands

5.sedcommandexamples
WhenyoucopyaDOSfiletoUnix,youcouldfind\r\nintheendofeachline.Thisexampleconverts
theDOSfileformattoUnixfileformatusingsedcommand.
$sed's/.$//'filename
http://www.thegeekstuff.com/2010/11/50linuxcommands/

2/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Printfilecontentinreverseorder
$sedn'1!G;h;$p'thegeekstuff.txt

Addlinenumberforallnonemptylinesinafile
$sed'/./='thegeekstuff.txt|sed'N;s/\n//'

Moresedexamples:AdvancedSedSubstitutionExamples

6.awkcommandexamples
Removeduplicatelinesusingawk
$awk'!($0inarray){array[$0];print}'temp

Printalllinesfrom/etc/passwdthathasthesameuidandgid
$awkF':''$3==$4'passwd.txt

Printonlyspecificfieldfromafile.
$awk'{print$2,$5;}'employee.txt

Moreawkexamples:8PowerfulAwkBuiltinVariablesFS,OFS,RS,ORS,NR,NF,FILENAME,
FNR

7.vimcommandexamples
Gotothe143rdlineoffile
$vim+143filename.txt

Gotothefirstmatchofthespecified
$vim+/searchtermfilename.txt

Openthefileinreadonlymode.
$vimR/etc/passwd

Morevimexamples:HowToRecordandPlayinVimEditor

8.diffcommandexamples
Ignorewhitespacewhilecomparing.
#diffwname_list.txtname_list_new.txt
2c2,3
<JohnDoe>JohnMDoe
>JasonBourne

Morediffexamples:Top4FileDifferenceToolsonUNIX/LinuxDiff,Colordiff,Wdiff,Vimdiff

9.sortcommandexamples
http://www.thegeekstuff.com/2010/11/50linuxcommands/

3/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Sortafileinascendingorder
$sortnames.txt

Sortafileindescendingorder
$sortrnames.txt

Sortpasswdfileby3rdfield.
$sortt:k3n/etc/passwd|more

10.exportcommandexamples
Tovieworaclerelatedenvironmentvariables.
$export|grepORACLE
declarexORACLE_BASE="/u01/app/oracle"
declarexORACLE_HOME="/u01/app/oracle/product/10.2.0"
declarexORACLE_SID="med"
declarexORACLE_TERM="xterm"

Toexportanenvironmentvariable:
$exportORACLE_HOME=/u01/app/oracle/product/10.2.0

11.xargscommandexamples
Copyallimagestoexternalharddrive
#ls*.jpg|xargsn1icp{}/externalharddrive/directory

Searchalljpgimagesinthesystemandarchiveit.
#find/name*.jpgtypefprint|xargstarcvzfimages.tar.gz

DownloadalltheURLsmentionedintheurllist.txtfile
#caturllist.txt|xargswgetc

12.lscommandexamples
Displayfilesizeinhumanreadableformat(e.g.KB,MBetc.,)
$lslh
rwr1rameshteamdev8.9MJun1215:27archlinux.txt.gz

OrderFilesBasedonLastModifiedTime(InReverseOrder)Usinglsltr
$lsltr

VisualClassificationofFilesWithSpecialCharactersUsinglsF
$lsF

Morelsexamples:UnixLSCommand:15PracticalExamples

13.pwdcommand
http://www.thegeekstuff.com/2010/11/50linuxcommands/

4/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

pwdisPrintworkingdirectory.Whatelsecanbesaidaboutthegoodoldpwdwhohasbeenprinting
thecurrentdirectorynameforages.

14.cdcommandexamples
Usecdtotogglebetweenthelasttwodirectories
Useshoptscdspelltoautomaticallycorrectmistypeddirectorynamesoncd
Morecdexamples:6AwesomeLinuxcdcommandHacks

15.gzipcommandexamples
Tocreatea*.gzcompressedfile:
$gziptest.txt

Touncompressa*.gzfile:
$gzipdtest.txt.gz

Displaycompressionratioofthecompressedfileusinggzipl
$gzipl*.gz
compresseduncompressedratiouncompressed_name
237099797575.8%asppatchrpms.txt

16.bzip2commandexamples
Tocreatea*.bz2compressedfile:
$bzip2test.txt

Touncompressa*.bz2file:
bzip2dtest.txt.bz2

Morebzip2examples:BZisEazy!bzip2,bzgrep,bzcmp,bzdiff,bzcat,bzless,bzmoreexamples

17.unzipcommandexamples
Toextracta*.zipcompressedfile:
$unziptest.zip

Viewthecontentsof*.zipfile(Withoutunzippingit):
$unzipljasper.zip
Archive:jasper.zip
LengthDateTimeName

4099511309823:50METAINF/MANIFEST.MF
3216908259821:07classes_
1596408259821:07classes_names
1054208259821:07classes_ncomp

18.shutdowncommandexamples
http://www.thegeekstuff.com/2010/11/50linuxcommands/

5/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Shutdownthesystemandturnthepoweroffimmediately.
#shutdownhnow

Shutdownthesystemafter10minutes.
#shutdownh+10

Rebootthesystemusingshutdowncommand.
#shutdownrnow

Forcethefilesystemcheckduringreboot.
#shutdownFrnow

19.ftpcommandexamples
Bothftpandsecureftp(sftp)hassimilarcommands.Toconnecttoaremoteserveranddownload
multiplefiles,dothefollowing.
$ftpIP/hostname
ftp>mget*.html

Toviewthefilenameslocatedontheremoteserverbeforedownloading,mlsftpcommandasshown
below.
ftp>mls*.html
/ftptest/features.html
/ftptest/index.html
/ftptest/othertools.html
/ftptest/samplereport.html
/ftptest/usage.html

Moreftpexamples:FTPandSFTPBeginnersGuidewith10Examples

20.crontabcommandexamples
Viewcrontabentryforaspecificuser
#crontabujohnl

Scheduleacronjobevery10minutes.
*/10****/home/ramesh/checkdiskspace

Morecrontabexamples:LinuxCrontab:15AwesomeCronJobExamples

21.servicecommandexamples
ServicecommandisusedtorunthesystemVinitscripts.i.eInsteadofcallingthescriptslocatedinthe
/etc/init.d/directorywiththeirfullpath,youcanusetheservicecommand.
Checkthestatusofaservice:
#servicesshstatus

Checkthestatusofalltheservices.
http://www.thegeekstuff.com/2010/11/50linuxcommands/

6/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

servicestatusall

Restartaservice.
#servicesshrestart

22.pscommandexamples
pscommandisusedtodisplayinformationabouttheprocessesthatarerunninginthesystem.
Whiletherearelotofargumentsthatcouldbepassedtoapscommand,followingaresomeofthe
commonones.
Toviewcurrentrunningprocesses.
$psef|more

Toviewcurrentrunningprocessesinatreestructure.Hoptionstandsforprocesshierarchy.
$psefH|more

23.freecommandexamples
Thiscommandisusedtodisplaythefree,used,swapmemoryavailableinthesystem.
Typicalfreecommandoutput.Theoutputisdisplayedinbytes.
$free
totalusedfreesharedbufferscached
Mem:3566408158022019861880203988902960
/+buffers/cache:4732723093136
Swap:400017604000176

IfyouwanttoquicklycheckhowmanyGBofRAMyoursystemhasusethegoption.boption
displaysinbytes,kinkilobytes,minmegabytes.
$freeg
totalusedfreesharedbufferscached
Mem:311000
/+buffers/cache:02
Swap:303

Ifyouwanttoseeatotalmemory(includingtheswap),usethetswitch,whichwilldisplayatotal
lineasshownbelow.
ramesh@rameshlaptop:~$freet
totalusedfreesharedbufferscached
Mem:3566408159214819742600204260912556
/+buffers/cache:4753323091076
Swap:400017604000176
Total:756658415921485974436

24.topcommandexamples
topcommanddisplaysthetopprocessesinthesystem(bydefaultsortedbycpuusage).Tosorttop
outputbyanycolumn,PressO(uppercaseO),whichwilldisplayallthepossiblecolumnsthatyou
cansortbyasshownbelow.
CurrentSortField:Pforwindow1:Def
http://www.thegeekstuff.com/2010/11/50linuxcommands/

7/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Selectsortfieldviafieldletter,typeanyotherkeytoreturn
a:PID=ProcessIdv:nDRT=DirtyPagescount
d:UID=UserIdy:WCHAN=SleepinginFunction
e:USER=UserNamez:Flags=TaskFlags
........

Todisplaysonlytheprocessesthatbelongtoaparticularuseruseuoption.Thefollowingwillshow
onlythetopprocessesthatbelongstooracleuser.
$topuoracle

Moretopexamples:CanYouTopThis?15PracticalLinuxTopCommandExamples

25.dfcommandexamples
Displaysthefilesystemdiskspaceusage.Bydefaultdfkdisplaysoutputinbytes.
$dfk
Filesystem1KblocksUsedAvailableUse%Mountedon
/dev/sda12953040032331042479723212%/
/dev/sda2120367992501715966408206044%/home

dfhdisplaysoutputinhumanreadableform.i.esizewillbedisplayedinGBs.
ramesh@rameshlaptop:~$dfh
FilesystemSizeUsedAvailUse%Mountedon
/dev/sda129G3.1G24G12%/
/dev/sda2115G48G62G44%/home

UseToptiontodisplaywhattypeoffilesystem.
ramesh@rameshlaptop:~$dfT
FilesystemType1KblocksUsedAvailableUse%Mountedon
/dev/sda1ext42953040032331202479721612%/
/dev/sda2ext4120367992501715966408206044%/home

26.killcommandexamples
Usekillcommandtoterminateaprocess.Firstgettheprocessidusingpsefcommand,thenusekill9
tokilltherunningLinuxprocessasshownbelow.Youcanalsousekillall,pkill,xkilltoterminatea
unixprocess.
$psef|grepvim
ramesh72437222922:43pts/200:00:00vim
$kill97243

Morekillexamples:4WaystoKillaProcesskill,killall,pkill,xkill

27.rmcommandexamples
Getconfirmationbeforeremovingthefile.
$rmifilename.txt

Itisveryusefulwhilegivingshellmetacharactersinthefilenameargument.
Printthefilenameandgetconfirmationbeforeremovingthefile.
http://www.thegeekstuff.com/2010/11/50linuxcommands/

8/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

$rmifile*

Followingexamplerecursivelyremovesallfilesanddirectoriesundertheexampledirectory.Thisalso
removestheexampledirectoryitself.
$rmrexample

28.cpcommandexamples
Copyfile1tofile2preservingthemode,ownershipandtimestamp.
$cppfile1file2

Copyfile1tofile2.iffile2existspromptforconfirmationbeforeoverwrittingit.
$cpifile1file2

29.mvcommandexamples
Renamefile1tofile2.iffile2existspromptforconfirmationbeforeoverwrittingit.
$mvifile1file2

Note:mvfisjusttheopposite,whichwilloverwritefile2withoutprompting.
mvvwillprintwhatishappeningduringfilerename,whichisusefulwhilespecifyingshell
metacharactersinthefilenameargument.
$mvvfile1file2

30.catcommandexamples
Youcanviewmultiplefilesatthesametime.Followingexampleprintsthecontentoffile1followed
byfile2tostdout.
$catfile1file2

Whiledisplayingthefile,followingcatncommandwillprependthelinenumbertoeachlineofthe
output.
$catn/etc/logrotate.conf
1 /var/log/btmp{
2 missingok
3 monthly
4 create0660rootutmp
5 rotate1
6 }

31.mountcommandexamples
Tomountafilesystem,youshouldfirstcreateadirectoryandmountitasshownbelow.
#mkdir/u01
#mount/dev/sdb1/u01

Youcanalsoaddthistothefstabforautomaticmounting.i.eAnytimesystemisrestarted,the
filesystemwillbemounted.
http://www.thegeekstuff.com/2010/11/50linuxcommands/

9/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

/dev/sdb1/u01ext2defaults02

32.chmodcommandexamples
chmodcommandisusedtochangethepermissionsforafileordirectory.
Givefullaccesstouserandgroup(i.eread,writeandexecute)onaspecificfile.
$chmodug+rwxfile.txt

Revokeallaccessforthegroup(i.eread,writeandexecute)onaspecificfile.
$chmodgrwxfile.txt

Applythefilepermissionsrecursivelytoallthefilesinthesubdirectories.
$chmodRug+rwxfile.txt

Morechmodexamples:7ChmodCommandExamplesforBeginners

33.chowncommandexamples
chowncommandisusedtochangetheownerandgroupofafile.\
Tochangeownertooracleandgrouptodbonafile.i.eChangebothownerandgroupatthesame
time.
$chownoracle:dbadbora.sh

UseRtochangetheownershiprecursively.
$chownRoracle:dba/home/oracle

34.passwdcommandexamples
Changeyourpasswordfromcommandlineusingpasswd.Thiswillpromptfortheoldpassword
followedbythenewpassword.
$passwd

Superusercanusepasswdcommandtoresetotherspassword.Thiswillnotpromptforcurrent
passwordoftheuser.
#passwdUSERNAME

Removepasswordforaspecificuser.Rootusercandisablepasswordforaspecificuser.Oncethe
passwordisdisabled,theusercanloginwithoutenteringthepassword.
#passwddUSERNAME

35.mkdircommandexamples
Followingexamplecreatesadirectorycalledtempunderyourhomedirectory.
$mkdir~/temp

Createnesteddirectoriesusingonemkdircommand.Ifanyofthesedirectoriesexistalready,itwillnot
http://www.thegeekstuff.com/2010/11/50linuxcommands/

10/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

displayanyerror.Ifanyofthesedirectoriesdoesntexist,itwillcreatethem.
$mkdirpdir1/dir2/dir3/dir4/

36.ifconfigcommandexamples
UseifconfigcommandtovieworconfigureanetworkinterfaceontheLinuxsystem.
Viewalltheinterfacesalongwithstatus.
$ifconfiga

Startorstopaspecificinterfaceusingupanddowncommandasshownbelow.
$ifconfigeth0up
$ifconfigeth0down

Moreifconfigexamples:Ifconfig:7ExamplesToConfigureNetworkInterface

37.unamecommandexamples
UnamecommanddisplaysimportantinformationaboutthesystemsuchasKernelname,Host
name,Kernelreleasenumber,
Processortype,etc.,
SampleunameoutputfromaUbuntulaptopisshownbelow.
$unamea
Linuxjohnlaptop2.6.3224generic#41UbuntuSMPThuAug1901:12:52UTC2010i686GNU/Linux

38.whereiscommandexamples
WhenyouwanttofindoutwhereaspecificUnixcommandexists(forexample,wheredoesls
commandexists?),youcanexecutethefollowingcommand.
$whereisls
ls:/bin/ls/usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz

Whenyouwanttosearchanexecutablefromapathotherthanthewhereisdefaultpath,youcanuseB
optionandgivepathasargumenttoit.Thissearchesfortheexecutablelsmkinthe/tmpdirectory,and
displaysit,ifitisavailable.
$whereisuB/tmpflsmk
lsmk:/tmp/lsmk

39.whatiscommandexamples
Whatiscommanddisplaysasinglelinedescriptionaboutacommand.
$whatisls
ls

(1)listdirectorycontents

$whatisifconfig
ifconfig(8)configureanetworkinterface

40.locatecommandexamples
http://www.thegeekstuff.com/2010/11/50linuxcommands/

11/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Usinglocatecommandyoucanquicklysearchforthelocationofaspecificfile(orgroupoffiles).
Locatecommandusesthedatabasecreatedbyupdatedb.
Theexamplebelowshowsallfilesinthesystemthatcontainsthewordcrontabinit.
$locatecrontab
/etc/anacrontab
/etc/crontab
/usr/bin/crontab
/usr/share/doc/cron/examples/crontab2english.pl.gz
/usr/share/man/man1/crontab.1.gz
/usr/share/man/man5/anacrontab.5.gz
/usr/share/man/man5/crontab.5.gz
/usr/share/vim/vim72/syntax/crontab.vim

41.mancommandexamples
Displaythemanpageofaspecificcommand.
$mancrontab

Whenamanpageforacommandislocatedundermorethanonesection,youcanviewthemanpage
forthatcommandfromaspecificsectionasshownbelow.
$manSECTIONNUMBERcommandname

Following8sectionsareavailableinthemanpage.
1. Generalcommands
2. Systemcalls
3. Clibraryfunctions
4. Specialfiles(usuallydevices,thosefoundin/dev)anddrivers
5. Fileformatsandconventions
6. Gamesandscreensavers
7. Miscellaneous
8. Systemadministrationcommandsanddaemons
Forexample,whenyoudowhatiscrontab,youllnoticethatcrontabhastwomanpages(section1and
section5).Toviewsection5ofcrontabmanpage,dothefollowing.
$whatiscrontab
crontab(1)maintaincrontabfilesforindividualusers(V3)
crontab(5)tablesfordrivingcron
$man5crontab

42.tailcommandexamples
Printthelast10linesofafilebydefault.
$tailfilename.txt

PrintNnumberoflinesfromthefilenamedfilename.txt
$tailnNfilename.txt

Viewthecontentofthefileinrealtimeusingtailf.Thisisusefultoviewthelogfiles,thatkeeps
growing.ThecommandcanbeterminatedusingCTRLC.
http://www.thegeekstuff.com/2010/11/50linuxcommands/

12/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

$tailflogfile

Moretailexamples:3MethodsToViewtailfoutputofMultipleLogFilesinOneTerminal

43.lesscommandexamples
lessisveryefficientwhileviewinghugelogfiles,asitdoesntneedtoloadthefullfilewhileopening.
$lesshugelogfile.log

Oneyouopenafileusinglesscommand,followingtwokeysareveryhelpful.
CTRL+Fforwardonewindow
CTRL+Bbackwardonewindow

Morelessexamples:UnixLessCommand:10TipsforEffectiveNavigation

44.sucommandexamples
Switchtoadifferentuseraccountusingsucommand.Superusercanswitchtoanyotheruserwithout
enteringtheirpassword.
$suUSERNAME

Executeasinglecommandfromadifferentaccountname.Inthefollowingexample,johncanexecute
thelscommandasrajusername.Oncethecommandisexecuted,itwillcomebacktojohnsaccount.
[john@devserver]$surajc'ls'
[john@devserver]$

Logintoaspecifieduseraccount,andexecutethespecifiedshellinsteadofthedefaultshell.
$sus'SHELLNAME'USERNAME

45.mysqlcommandexamples
mysqlisprobablythemostwidelyusedopensourcedatabaseonLinux.Evenifyoudontrunamysql
databaseonyourserver,youmightendupusingthemysqlcommand(client)toconnecttoamysql
databaserunningontheremoteserver.
Toconnecttoaremotemysqldatabase.Thiswillpromptforapassword.
$mysqlurootph192.168.1.2

Toconnecttoalocalmysqldatabase.
$mysqlurootp

Ifyouwanttospecifythemysqlrootpasswordinthecommandlineitself,enteritimmediatelyafterp
(withoutanyspace).

46.yumcommandexamples
Toinstallapacheusingyum.
$yuminstallhttpd
http://www.thegeekstuff.com/2010/11/50linuxcommands/

13/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Toupgradeapacheusingyum.
$yumupdatehttpd

Touninstall/removeapacheusingyum.
$yumremovehttpd

47.rpmcommandexamples
Toinstallapacheusingrpm.
#rpmivhhttpd2.2.322.0.1.el5.i386.rpm

Toupgradeapacheusingrpm.
#rpmuvhhttpd2.2.322.0.1.el5.i386.rpm

Touninstall/removeapacheusingrpm.
#rpmevhttpd

Morerpmexamples:RPMCommand:15ExamplestoInstall,Uninstall,Upgrade,QueryRPM
Packages

48.pingcommandexamples
Pingaremotehostbysendingonly5packets.
$pingc5gmail.com

Morepingexamples:PingTutorial:15EffectivePingCommandExamples

49.datecommandexamples
Setthesystemdate:
#dates"01/31/201023:59:53"

Onceyouvechangedthesystemdate,youshouldsyncronizethehardwareclockwiththesystemdate
asshownbelow.
#hwclocksystohc
#hwclocksystohcutc

50.wgetcommandexamples
Thequickandeffectivemethodtodownloadsoftware,music,videofrominternetisusingwget
command.
$wgethttp://prdownloads.sourceforge.net/sourceforge/nagios/nagios3.2.1.tar.gz

Downloadandstoreitwithadifferentname.
$wgetOtaglist.ziphttp://www.vim.org/scripts/download_script.php?src_id=7701

http://www.thegeekstuff.com/2010/11/50linuxcommands/

14/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Morewgetexamples:TheUltimateWgetDownloadGuideWith15AwesomeExamples
DidImissanyfrequentlyusedLinuxcommands?Leaveacommentandletmeknow.
333

Tweet

391

Like

573

>Addyourcomment

Ifyouenjoyedthisarticle,youmightalsolike..
1. 50LinuxSysadminTutorials
2. 50MostFrequentlyUsedLinuxCommands
(WithExamples)
3. Top25BestLinuxPerformanceMonitoring
andDebuggingTools
4. Mommy,Ifoundit!15PracticalLinuxFind
CommandExamples
5. Linux101Hacks2ndEditioneBook

AwkIntroduction7AwkPrint
Examples
AdvancedSedSubstitutionExamples
8EssentialVimEditorNavigation
Fundamentals
25MostFrequentlyUsedLinux
IPTablesRulesExamples
TurbochargePuTTYwith12Powerful
AddOns

{226commentsaddone}
PreviousComments
maheshAugust6,2014,8:04am
thanksalot.
Link
adomblessingAugust20,2014,7:52am
thanksforthis.itsreallyhelpful
Link
devrajbharSeptember10,2014,9:47pm
iwanttoknowallsimplecommandoftheunix
Link
JohnSeptember13,2014,11:25am
MaybeitwouldbeinterestingtodifferbetweenusingLinux/Unixasanadminorasanon
http://www.thegeekstuff.com/2010/11/50linuxcommands/

15/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

admin,sincesomecommandsareuselessforanonadmin
IpersonallymissVIinthislist
SHUTDOWNmaybereplacedbyINIT
LSisalsoaninterestingone,andWHICHdefinatelyis
Thenagain,basicisthisoneaswell:ECHO
Link
chandruSeptember18,2014,11:56am
Hi,
Iamusingtoshibasatellitelaptop.Afterinstallingredhatlinux6inmylaptopethernetnot
detected.Kindlyhelp
Myhardareinformation:
Processor:intelpentiumcpuB9602.20GHZ2100.00mhz
Ehternet:03:00.0ehternetcontrolleratheroscommunicationsincdevice10a0(rev10).
Link
NicholasLeeFaganSeptember20,2014,2:26pm
51.)Rsync
Link
dhirenOctober7,2014,3:11am
Multiplefilesisthereintape.
iamnocheckendofthedisk.
howtodumpallfilesintape..
anyscript
Link
mrutyunjayOctober9,2014,12:31am
Ididntgotawkcommand.Itriedbutitcantworkproperly.
Link
JimO'ReillyOctober22,2014,7:03am
wc
Link
nnsenseNovember27,2014,8:28am
pwdisPrintworkingdirectory.Whatelsecanbesaidaboutthegoodoldpwdwhohasbeen
printingthecurrentdirectorynameforages.
CanbesaidthatpwdPshowstherealpathifyoucdintoalink..
Example
$cd/home/user
$lns./Public./Pub
$cdPub
$pwd
/home/user/Pub
$pwdP
/home/nnsense/Public
http://www.thegeekstuff.com/2010/11/50linuxcommands/

16/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

useful,isntit??
Link
krupaliDecember7,2014,12:27am
Writeashellscripttodisplayalllinesofafilefrombottomtotop.
Canyouhelpmewiththis??
Link
TimChaseDecember8,2014,10:43pm
Krupali,
Youcanusethefairlystandardtacutility(inDebianscoreutilspackage).Thereareplenty
ofotherwaystodoit,butthatsthemoststraightforward.
Link
SanthoshKDecember26,2014,3:58am
Krupali,
Haveyoubeenabletoscripttodisplayalllinesofafilefrombottomtotop?Itriedwithno
luck..
Link
SanthoshKDecember26,2014,8:23am
Krupali,
Youmaytrythis:
#!/bin/sh
cpfile.txttemp.txt
n=`catfile.txt|wcl`
while[$nge0]
do
tail1temp.txt>>result.txt
sedi$dtemp.txt
n=`expr$n1`
done
rmftemp.txt
catresult.txt
Link
PreetiShrivastavaDecember29,2014,5:31am
ducommandisalsousedforcheckingdiskspaceusage.
Link
EirikB.January3,2015,10:24pm
Hereisasafealternativeto$seds/.$//filename,
whichwillonlyremove\r\nattheendoflines(as.matches*any*character.):
$perlpes/\r\n$/\n/gfilename
http://www.thegeekstuff.com/2010/11/50linuxcommands/

17/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Replacesallinstancesof\r\nwith\n
Link
shilpaJanuary30,2015,4:38am
thanksalot
Link
CharlesBeatonFebruary2,2015,7:31am
Howaboutcpio?Particularlythefind./|cpiocomboie:
find./mountdepthprint|cpiopdm/destination_dir
C
Link
DGFebruary25,2015,4:01pm
Thanks..NiceTutorial.
Link
vietvuFebruary27,2015,2:25am
Thelistisfine,however,Ithinkthatmanshouldbeontop.Youknowwhy
Link
madhuApril11,2015,12:01am
goodstuff
Link
kiranApril22,2015,8:08pm
Iwantascriptwhereineedtotakethelistoffilesofparticulardateandputtheminarchieve(any
fromarchieve1to8)
Link
AnonymousApril29,2015,12:20am
Thanksforinfo!!!
Link
AnonymousMay13,2015,2:52am
thanks
Link
AnonymousMay27,2015,7:16am
UsefullCollection:)
Link
YutiJuly24,2015,3:46am
THANKYOU!
http://www.thegeekstuff.com/2010/11/50linuxcommands/

18/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Link
PreviousComments
LeaveaComment
Name
Email
Website

Comment
Submit

Notifymeoffollowupcommentsviaemail
Nextpost:LinuxmodprobeCommandExamplestoView,Install,RemoveModules
Previouspost:LinuxStringsCommandExamples(SearchTextinUNIXBinaryFiles)
RSS|Email|Twitter|Facebook|Google+
Search

EBOOKS
Linux101Hacks2ndEditioneBookPracticalExamplestoBuildaStrongFoundationin
Linux
Bash101HackseBookTakeControlofYourBashCommandLineandShellScripting
SedandAwk101HackseBookEnhanceYourUNIX/LinuxLifewithSedandAwk
Vim101HackseBookPracticalExamplesforBecomingFastandProductiveinVimEditor
NagiosCore3eBookMonitorEverything,BeProactive,andSleepWell

http://www.thegeekstuff.com/2010/11/50linuxcommands/

19/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

TheGeekStuff
12,225likes

LikePage

Share

Bethefirstofyourfriendstolikethis

POPULARPOSTS
12AmazingandEssentialLinuxBooksToEnrichYourBrainandLibrary
50UNIX/LinuxSysadminTutorials
50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)
HowToBeProductiveandGetThingsDoneUsingGTD
30ThingsToDoWhenyouareBoredandhaveaComputer
LinuxDirectoryStructure(FileSystemStructure)ExplainedwithExamples
LinuxCrontab:15AwesomeCronJobExamples
GetaGripontheGrep!15PracticalGrepCommandExamples
UnixLSCommand:15PracticalExamples
15ExamplesToMasterLinuxCommandLineHistory
Top10OpenSourceBugTrackingSystem
ViandVimMacroTutorial:HowToRecordandPlay
Mommy,Ifoundit!15PracticalLinuxFindCommandExamples
15AwesomeGmailTipsandTricks
15AwesomeGoogleSearchTipsandTricks
RAID0,RAID1,RAID5,RAID10ExplainedwithDiagrams
CanYouTopThis?15PracticalLinuxTopCommandExamples
Top5BestSystemMonitoringTools
Top5BestLinuxOSDistributions
HowToMonitorRemoteLinuxHostusingNagios3.0
AwkIntroductionTutorial7AwkPrintExamples
HowtoBackupLinux?15rsyncCommandExamples
TheUltimateWgetDownloadGuideWith15AwesomeExamples
Top5BestLinuxTextEditors
PacketAnalyzer:15TCPDUMPCommandExamples
TheUltimateBashArrayTutorialwith15Examples
3StepstoPerformSSHLoginWithoutPasswordUsingsshkeygen&sshcopyid
UnixSedTutorial:AdvancedSedSubstitutionExamples
UNIX/Linux:10NetstatCommandExamples
TheUltimateGuideforCreatingStrongPasswords
6StepstoSecureYourHomeWirelessNetwork
TurbochargePuTTYwith12PowerfulAddOns
CATEGORIES
LinuxTutorials
VimEditor
http://www.thegeekstuff.com/2010/11/50linuxcommands/

20/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

SedScripting
AwkScripting
BashShellScripting
NagiosMonitoring
OpenSSH
IPTablesFirewall
ApacheWebServer
MySQLDatabase
PerlProgramming
GoogleTutorials
UbuntuTutorials
PostgreSQLDB
HelloWorldExamples
CProgramming
C++Programming
DELLServerTutorials
OracleDatabase
VMwareTutorials
Ramesh Natarajan
Follow

AboutTheGeekStuff

MynameisRameshNatarajan.Iwillbepostinginstructionguides,howto,
troubleshootingtipsandtricksonLinux,database,hardware,securityandweb.Myfocusistowrite
articlesthatwilleitherteachyouorhelpyouresolveaproblem.ReadmoreaboutRameshNatarajan
andtheblog.
ContactUs
EmailMe:UsethisContactFormtogetintouchmewithyourcomments,questionsorsuggestions
aboutthissite.Youcanalsosimplydropmealinetosayhello!.
FollowusonGoogle+
FollowusonTwitter
BecomeafanonFacebook
SupportUs

http://www.thegeekstuff.com/2010/11/50linuxcommands/

21/22

06/09/2015

50MostFrequentlyUsedUNIX/LinuxCommands(WithExamples)

Supportthisblogbypurchasingoneofmyebooks.
Bash101HackseBook
SedandAwk101HackseBook
Vim101HackseBook
NagiosCore3eBook
Copyright20082015RameshNatarajan.Allrightsreserved|TermsofService

http://www.thegeekstuff.com/2010/11/50linuxcommands/

22/22

Potrebbero piacerti anche