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 /

Related Posts:

  • How to Disable CPU Cores CPU Information I’ve Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz processor, Which has 8 cores. [mitesh@Matrix ~]$ cat /proc/cpuinfo | grep processor processor : 0 processor : 1 processor : 2 processor : 3 processor : 4 proces… Read More
  • Fix cứng DNS resolver trên LinuxHầu hết các hệ thống GNU/Linux đều được tích hợp và sử dụng DHCP Client. DHCP Client cung cấp phương thức cho việc cấu hình một hay nhiều card mạng sử dụng địa chỉ động (DHCP). Tuy nhiên nó lại làm thay đổi tệp tin&… Read More
  • Tìm hiểu cách lưu trữ mật khẩu người dùng trên Linux Nếu bạn là người quản trị hệ thống Linux thường xuyên thì việc login/logout vào hệ thống là điều mặc định hiển nhiên. Trên màn hình đăng nhập, Linux yêu cầu bạn nhập username/password, nếu bạn nhập chính xác thì bạn đăng nhậ… Read More
  • Assign Multiple IP Address Assign Multiple IP Address to Single LAN Card is called IP Aliasing IP Aliasing is useful for create virtual websites on Apache or Nginx. The main advantage of IP Alias is, you don’t have to purchase new LAN Card for each ip… Read More
  • Disable IPv6 on Linux Check IPv6 is Enabled/Disabled [mitesh@Matrix ~]$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6 NOTE! If above command return1 means ipv6 is completely disabled0 means ipv6 is not completely disabled Disable IPv6 Te… Read More

0 comments:

Post a Comment