Wednesday, September 26, 2012

Commands that Should Never Run on Linux

There are some commands which a user should not run on Linux, because these commands can harm and destroy many things which are very important for the system. These problems are faced mostly by the new users of Linux. They run any commands on the terminal as they don’t have the knowledge about the Linux, and these commands cause them a lot. And the main thing is that the terminal never shows the warning message before we wish to run any commands on Linux terminal. So the care must be taken by the users before running any commands on Linux terminal.
So, some of the commands are as follows:
·         rm –rf/          :- DELETES EVERYTHING
The above command deletes everything which can be possible. Like the files on hard drives and attached removable device to the system.

rm      :This is for removing the files.
-rf       :Run rm recursively forcibly deletes the file and folder inside the specified folder without doing the confirmation.
/     -It says to start with the root directory.

The other commands like rm –rf~ will delete the files and folders of Home and the command rm –rf* will delete the configuration files.

·         :(){:|: &};:       :- FORK
The above command will creates the replica of itself .The process goes on and the duplicate copies also starts to create the replica of itself. This will take all the CPU time and memory.

·         mkfs.ext4/dev/sda1          :- FORMATS A HARD DRIVE
The above command will format the hard drive

mkfs.ext4      :This create a new ext4 file system on the following device.
dev/sda1      :This specifies the first partition of the hard drive.

This command will format the c:drive of the windows i.e. this will replace the first partition of the hard drive with the new file system. Similarly mkfs.ext3/dev/sda2 will format the second partition of the hard drive.

·         dd if=/dev/random of=/dev/sda :-WRITES THE GARBAGE ON THE HARD

This command will write the garbage values on to the hard drive.

dd=  : This part of the command performs the low level copying from one      
location to another.
if=/dev/random    -Use /dev/random as the input.
of=/dev/sda           -This outputs to the first hard disk causing to replace the file
                                     system with the random garbage values.

This command moves the file to /dev/null which is the special location. The moving of file to null location is similarly to destroying the files. This will move the files to /dev/null location as well it deletes the original copies.

mv     – This moves the file or folders to another location.
~         -This represents the entire home folder.
/dev/null    -Move the home folder to the /dev/null location.

·         command>/dev/sda :-WRITES DIRECTLY ON THE HARD DRIVE
The above command will run the command part and the output of that command is send directly to the hard drive. This directly writes the data onto the hard drive thus damaging the file system.

command  -This runs any command.
             >    - Sends  the output of the command to following path.
             /dev/sda  -This writes the output of the command directly onto the hard disk.

·         wget –o -|sh  :-DOWNLOADS AND RUN                     THE SCRIPT
This command downloads the script file which is mentioned, from the web and sends to sh, which executes the contents of the script. This can be harmful if we are not sure about the script code and its source. So we should not download from any unauthorized source.

wget  -Downloads the file.  -Download the file from this specified location.
| - This is the pipe which sends the output of the wget command i.e. the                    downloaded file.
sh – The file is sent to the sh command and it executes the file.

The user must have the complete knowledge about the command he wishes to run on the terminal. So he can himself, judge out the output and causes of the command. Otherwise, he has to face lots of consequences.