July 2, 2015

Deadly Linux Commands

  • If you are new to Linux, chances are you will meet a stupid person perhaps in a forum or chat room that can trick you into using commands that will harm your files or even your entire operating system.
  • Don’t run anything without understanding exactly what it does. Look it up (use Google orman command) if there’s any part of a command you’re not clear on.
  • Also you can use http://explainshell.com/ to explain what command is.
  • To avoid this dangerous scenario from happening, I have here a list of deadly (Most Dangerous) Linux commands that you should avoid

Delete Everything Recursively

  • This command will recursively and forcefully delete all the files inside the / root directory.
[mitesh@Matrix ~]$ sudo rm -rf /

Fork Bomb

  • The following weird looking command is actually function which created copies of itself endlessly.
  • This Fork Bomb quickly use all your system resources like CPU, RAM, etc and cause system crash.
  • This can often lead to corruption of data.
  • For More Detailed Information Refer https://en.wikipedia.org/wiki/Fork_bomb
[mitesh@Matrix ~]$ :(){:|:&};:

Format Hard Disk Drive

  • This will reformat or wipeout all the files of the device that is mentioned after the mkfscommand.
[mitesh@Matrix ~]$ sudo mkfs.ext3 /dev/sda

Fill Hard Disk Drive with Junk Data

# Fill HDD with letter y
[mitesh@Matrix ~]$ sudo yes > /dev/sda
# Fill HDD with number zero 0
[mitesh@Matrix ~]$ sudo dd if=/dev/null of=/dev/sda
# Fill HDD with random data
[mitesh@Matrix ~]$ sudo dd if=/dev/urandom of=/dev/sda
# Overwrite HDD Data (Multiple Times)
[mitesh@Matrix ~]$ sudo shred /dev/sda

Delete /etc Directory

  • The following command delete all the linux configuration files.
# Delete /boot Directory
[mitesh@Matrix ~]$ sudo rm -rf /etc

Delete Boot Entry

  • The following command delete Kernel, Initrd, and GRUB/LILO Files (Needed For Linux Startup)
# Delete /boot Directory
[mitesh@Matrix ~]$ sudo rm -rf /boot/

Move Everything to Blackhole

  • This command will move all the files inside your home directory to a /dev/null(Blackhole)
[mitesh@Matrix ~]$ mv ~/* /dev/null
[mitesh@Matrix ~]$ mv /home/username/* /dev/null

Find and Delete configuration files

[mitesh@Matrix ~]$ sudo find / -iname "*.conf" -exec rm -rf  {} \;

World Writable

  • The following command make your system world writable.
[mitesh@Matrix ~]$ sudo chmod -R 777 /

Remove Access Privilege

[mitesh@Matrix ~]$ sudo chmod -R 000 /
# Another way
[mitesh@Matrix ~]$ sudo chown -R nobody:nobody /

0 comments:

Post a Comment