Deadly Linux Commands ( Use Carefully )

Deadly Linux Commands ( Use Carefully )

by -
0 1049

Shred  ( Useful but dangerous )

Sometimes you need to destroy or wipe data from hard drives (for example, before you sell your old hard drives) so that nobody else can access them. Simply deleting data (e.g. with rm) is not enough because that just removes the file system pointer, but not the data, so it can easily be undeleted with recovery software. Even zero’ing out your hard drive might not be enough. Here’s where shred comes into play – shred can overwrite the files and partitions repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.

to wipe a full hard drive like /dev/sda, you can use

# 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

Command is same for IDE hard disk hda (PC/Windows first hard disk connected to IDE)


Moves Your Home Directory to a Black Hole

# mv ~ /dev/null

/dev/null is another special location – moving something to /dev/null is the same thing as destroying it. Think of /dev/null as a black hole. Essentially, mv ~ /dev/null sends all your personal files into a black hole.

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

~ – Represents your entire home folder.

/dev/null – Move your home folder to /dev/null, destroying all your files and deleting the original copies.


Fork Bomb

The following line is a simple-looking, but dangerous, bash function:

:(){ :|: & };:

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. It’s basically a denial-of-service attack.

Command > /dev/sda

The above command writes the output of ‘command‘ on the block /dev/sda. The above command writes raw data and all the files on the block will be replaced with raw data, thus resulting in total loss of data on the block. beware running commands that involve hard disk devices beginning with /dev/sd.


Writes Junk Onto a Hard Drive

# dd if=/dev/random of=/dev/sda

The dd if=/dev/random of=/dev/sda line will also obliterate the data on one of your hard drives.


Deletes Everything

# rm -rf  /

The command rm -rf / deletes everything it possible can, including files on your hard drive and files on connected removable media devices.

This command will delete everything without prompting you, so be careful when using it. The rm command can also be used in other dangerous ways.

# rm –rf  ~     would delete all files in your home folder,

# rm –rf   .*      would delete all your configuration files.

Format Hard Drive

# mkfs.ext3 /dev/sda

This command is really a disaster as it formats your entire hard drive and replaces it with the new ext3 file system. Once you execute the command, all your data is lost irrecoverably. So never ever try this command.


 cat command

Even cat looks very simple, we have seen lot of time linux users overwriting very important file using redirection command. Make sure the name of the file you are creating does not match the name of a existing file. If you plan to append make sure you use “>>” and not “>”

Important : Avoid this

# cat > /dev/sda


commands can be execute by chance , by mistake ..carefully handle above commands, may be dangerous, can create a disaster

Enjoy Linux…it works


Download PDF

CEO, KV IT-Solutions Pvt. Ltd. | [email protected] | 9810028374|
Linux Professional and an Industrial Trainer | 20 + years Experience in IT Industry

” We are born free, No Gate and Windows can snatch our freedom “


0 1700

0 1355

0 1218


Leave a Reply