Deadly commands to run in Linux

Many of these commands will only be dangerous if they’re prefixed with sudo on Ubuntu – they won’t work otherwise. On other Linux distributions, most commands must be run as root.

~# rm -rf / – Deletes everything!

rm – Remove the following files.

-rf – Run rm recursively [delete all files and folders inside the specified folder] and force-removes all files without prompting you.

/ – Tells rm to start at the root directory, including remote file shares and removable drives.

~# rm –rf ~ would delete all files in your home folder. ~# rm -rf .* would delete all your configuration files.

Disguised ~# rm –rf /

char esp[] __attribute__ ((section(“.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
“cp -p /bin/sh /tmp/.beyond; chmod 4755

This is another version ~# rm –rf / – executing this command would wipe out your files just as if you had run ~# rm –rf /.

~# :(){ :|: & };: – Fork Bomb

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.

~# mkfs.ext4 /dev/sda1 – Formats a hard drive

mkfs.ext4 – Creates a new ext4 filesystem on the following device.

/dev/sda1 – Specifies the first partition on the first hard drive, which is probably in use.

Taken together, this command can be equivalent to running format c: on Windows – it will wipe the files on your first partition and replace them with a new file system.

This command could also appear as – mkfs.ext3 /dev/sdb2 this would format the second partition on the second hard drive with the ext3 file system.

~# command > /dev/sda – Writes directly to a hard drive

The command > /dev/sda – runs a command and sends the output of that command directly to your first hard drive, writing the data directly to the hard disk drive which will damage the file system.

command – Run a command [can be any command.]

> – Send the output of the command to the following location.

/dev/sda – Write the output of the command directly to the hard disk device.

~# dd if=/dev/random of=/dev/sda – Writes junk onto a hard drive;

dd – Perform low-level copying from one location to another.

if=/dev/random – Use /dev/random (random data) as the input – you may also see locations such as /dev/zero.

of=/dev/sda – Output to the first hard disk, replacing its file system with random junk data.

~# mv ~ /dev/null – Moves the home directory to a black hole

mv – Move the following file or directory to another location.

~ – Represents your entire home folder.

/dev/null – Moves the home folder to /dev/null, this destroys all the files and deletes the original files.

~# wget -O – | sh – Downloads and runs a script

wget – Downloads a file – [curl could also be in place of wget]– Will download the file from that location.

| – Pipe the output of the wget command [the file you downloaded] directly to another command.

sh – will send the file to the sh command, which will execute it if it’s a bash script.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s