· random sysad

Lethal Linux Commands

I am attempting to collect a list of every command that should NEVER be run on a system you care about. Commands that will crash your system where you will have no choice but to reboot or even worse, end up with complete data loss or corruption.

NEVER RUN THESE COMMANDS ON A SERVER YOU CARE ABOUT

There is no doubt you will want to run these, so head over to VirtualBox and download, install and setup a Linux VM. The distribution does not matter but I recommend CentOS.

sudo rm -rf /

The rm command is remove. / is the root filesystem, where everything the OS needs to run and your data as well. The command recursively (-r) and forcefully (-f) without any warning or confirmation deletes everything.

rm -rf ./*

Similar to the above but deletes everything from your current directory, recursively. If you are in / then its the same command as the above so it can be just as damaging.

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

This command will continually write zeros to your entire hard disk, wiping all data and even the partition table, recovery is extremely difficult and potentially expensive.

mkfs.ext4 /dev/sda

This command formats the hard drive to use the ext4 filesystem. Disk drive formatting is not an inherently malicious action, but it does wipe the drive so that it’s as “good as new”. Recovery -can- be possible but by professionals and will be expensive.

:(){ :|: & };:

This is a fork bomb, it is a never end function that will keep doubling up until you run out of system resources. See here for a really good explanation.

command > /dev/sda

The > operator redirects the output from the command on its left to the file on its right. In this case, the ‘file’ is the whole hard drive. The raw data is being redirected and used to overwrite the system hard drive.

find / -type f -mtime +30 -exec mv {} /dev/null \;

This will find any file modified in the last 30 days and move them to /dev/null. /dev/null is equivalent to a black hole, nothing escapes and nothing returns.

mv / /dev/null

This moves your root filesystem to /dev/null

If you know any other commands that can inflict damage to your running Linux system or pose fatal problems to system administrators — just comment it here so I could update this post.

  • LinkedIn
  • Tumblr
  • Reddit

Aaron Mehar

Berkshire, UK