As a Linux user, you probably have
searched online for articles and tutorials that show you how to use the
terminal to run some commands. While most of these commands are harmless and
could help you become more productive, there are some commands that are deadly
and could wipe out your whole machine.
In this article, let’s check out some of
the deadly Linux commands that you should never run.
Note: These commands are really
harmful, so please don’t try to reproduce them on your Linux machines. You have
been warned.
1.
Deletes Everything Recursively
rm -rf /
This is one of the most deadly Linux
commands around. The functionality of this command is really simple. It
forcefully removes or deletes (rm) all the files and folders recursively (-rf)
in the root directory (/) of your Linux machine. Once you delete all the files
in the root directory, there is no way that you can boot into your Linux system
again.
Also be aware that the below command
comes in many other forms such as rm -rf * or rm -rf. So always
be careful when ever you are executing a command that includes rm.
2.
Fork Bomb
:(){ :|: & };:
This weird looking command doesn’t even
look like a command, but it functions like a virus which creates copies of
itself endlessly, thus called as Fork Bomb. This shell function quickly hijacks
all your system resources like CPU, memory, etc. and will cause a system
crash which in turn may result in data loss. So never ever try this command or
any other weird-looking commands for that matter.
3.
Move Everything to Nothingness
mv ~ /dev/null
The functionality of this command is
really basic and simple. All it does is move (mv) the contents of your home
folder (~) into the /dev/null folder. This looks really innocent, but
the catch is that there is no folder called “Null,” and it simply means that
you are moving all your files and folders into nothingness essentially
destroying all the files irrecoverably.
4.
Format Hard Drive
mkfs.ext3 /dev/sda
This command is really a disaster as
it formats your entire hard drive and replaces it with the new ext3 file
system. Once you execute the command, all your data is lost irrecoverably. So
never ever try this command or any other suspicious command that involves your
hard drive (sda).
5.
Output Command Directly to Hard Drive
any-command > /dev/sda
This command is much more simple; any
command you execute (in the place of “any-command”) will write the output data
to your first hard drive replacing all the files and folders. This in turn
damages your entire file system. Once you execute this command, you will be
unable to boot into your Linux machine and your data may be lost irrecoverably.
Again, don’t ever try any suspicious
command that includes your hard drive (sda).
6. Erase your MBR on Linux
There is an easy way to erase (format) your MBR in Linux, using the dd command.
The following steps should not be taken lightly, and you should always have a backup of your data before attempting such things!
The following command will erase mbr, but not your partitions:
# dd if=/dev/zero of=/dev/sdc bs=446 count=1
Where,
- bs=446 - Read from /dev/zero and write to /dev/sdc up to 446 BYTES bytes at a time.
Note the blocksize of 446 is supposed to erase everything up to your partition table, but not your partition table itself.
Open a terminal and type the following command command to delete everything:
# dd if=/dev/zero of=/dev/sdc bs=512 count=1
Sample outputs:
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00308483 s, 166 kB/s4
Where,
- if=/dev/zero - Read data from /dev/zero and write it to /dev/sdc.
- of=/dev/sdc - /dev/sdc is the USB drive to remove the MBR including all partitions.
- bs=512 - Read from /dev/zero and write to /dev/sdc up to 512 BYTES bytes at a time.
- count=1 - Copy only 1 BLOCK input blocks.
Conclusion
Using the command line is pretty
interesting but don’t blindly execute all the commands you find in the
internet. A single command is enough to wipe out your whole system. In addition,
while some of the commands above require elevated permissions (administrator),
they may be disguised in other commands and may trick you into
executing them.
So always be careful while you are
executing the commands and only trust reputed and trusted sources for your
command line requirements. The best way is to educate yourselves on how each
command works and think through before executing the command.
No comments:
Post a Comment
Thank You:)