Friday, 15 February 2019

crash your Linux system: Dangerous Commands

inux commands can be very dangerous when not used properly. It makes you a hero and zero in a second. Without proper knowledge one can easily destroy their system in seconds and we know internet is full of trolls, so having knowledge of these dangerous commands can be useful for beginners.
NOTE: If someone give you advice to execute a gibberish command and you don't know about that, then you can easily check it via explain shell.
Here's a list of some of the dangerous commands that can harm your system or completely destroy them:

1. Deletes everything recursively

The most dangerous command will delete everything from your system.
## delete root directory entirely
$ rm -rf /
Bash
And the other variations of this command are:
## delete the home folder
$ rm -rf ~
## delete everything from current folder
$ rm -rf *
## delete all your configuration files
$ rm -rf .*
Bash

2. Fork Bomb Command :(){ :|: & };:

This weird looking command will create endless copies of itself which will cause your system to hang and may result in corruption of data.
$ :(){ :|: & };:
Bash

3. Format entire hard drive

$ mkfs.ext4 /dev/sda1
Bash
This command will reformat your entire hard drive using ext4 filesystem. Here /dev/sda1 is the path of first partition.
Other variation of this command is mkfs.ext3.

4. Flushing the hard drive.

$ anybashcommand > /dev/sda
Bash
It writes directly to primary hard drive and therefore crash all the data with raw buffer data.

5. Fill your hard drive with zero's

$$ dd if=/dev/zero of=/dev/hda
Bash
Here dd performs low level copying from one location to another, where if=/dev/zero produce infinite streams of zero in /dev/hda.

6. Creating a black hole in hard drive.

$ mv / /dev/null
Bash
Here '/dev/null' is a special location in hard disk which can be think as a black hole. Everything you put into it will be dissolved.

7. Delete superuser

$ rm -f /usr/bin/sudo;rm -f /bin/su
Bash
It will revoke superuser access from root user and thereby unable to perform any root privileges command.

8. Delete boot directory

$ rm -rf /boot
Bash
The boot directory is used for system startup, kernal loading etc. Deleting it will unable to perform any system startup and thereby crash linux.

No comments: