🛑 Linux Commands You Should Never Run on Your System

This article focuses on some Linux commands that you should never run on your system, as they can prove fatal to your Linux systems.

So, before proceeding, I would like to point out that this article is written for information purposes only so that readers know that any of the following commands should be avoided.

All of the commands mentioned here can have serious consequences for your system and its data.

1- Format the system disk

Linux administrator very often uses this command to format and assign the file system to the newly created disk partition.

But if used irresponsibly, this can also format the data drive on it:

$ mkfs.ext4 /dev/sda

Therefore, when using this command, make sure the correct disk partition is selected.

/ etc contains all the system configuration files, and / boot contains all the kernel, InitRD, and GRUB files needed to boot the system.

If you delete any of these folders, then your system will not boot:

$ rm -rf /etc
$ rm -rf /boot

Another way to remove your system configuration files and leave it irrecoverable is to use the following command:

$ find / -iname "*.conf" -exec rm -rf {} ;

This will find and remove all files ending in .conf (configuration files).

Most of you may know about this command, and it looks like this:

$ rm -rf /

This will remove the entire filesystem from your server, deleting every byte of data on the disk.

4- Fork bomb

This command creates copies of itself indefinitely, and in no time the whole memory of your system will be clogged and therefore it will cause the system to crash,

$:(){ :|:& };:

It can also damage the disc.

5- Fill the disk with random data

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

This will fill the disk with random data. Another variation of this command overwrites the disk multiple times over the original data:

$ shred /dev/sda

This command is actually a useful tool, especially when you are throwing away your old drive and you don’t want the data from the old drive to fall into the wrong hands (and another way I learned from the movies is you can drill some holes in the drives as well) …

6- File Violation

All of the above commands are for deleting or overwriting data. But there are ways to disable your system using file permissions. First command:

$ chmod -Rv 000 /

This command will remove all file permissions for all files and folders on the system, and since no one will have permissions on files and folders, no one will be able to access them.

$ chown -R nobody:nobody /

This will also give the same result as above. Now the following command is actually the opposite of the first one:

$ chmod -R 777 /

This will change the permissions for all files and folders so that they are writable to everyone. And I’m sure you can imagine what would happen in such a scenario. So this was our list of Linux commands that you should never run on your system. Please feel free to submit any questions or requests regarding this article using the comment box below.

Sidebar