5 Deadly Linux Commands You Should Never Run

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

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

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

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

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).


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.

The above list is definitely not conclusive and there are still tons of deadly commands that we are not able to cover. If you know of any, feel free to share them in the comments below.

Vamsi Krishna Vamsi Krishna

Vamsi is a tech and WordPress geek who enjoys writing how-to guides and messing with his computer and software in general. When not writing for MTE, he writes for he shares tips, tricks, and lifehacks on his own blog Stugon.


    1. Wow… you really know very little about operating systems! Bunching in C64 with Linux… REALLY?!? You use Linux everyday and don’t even know it.

    2. Speak for yourself, Softsmyth, Linux use is pervasive throughout the IT world. I work for a fortune 50 company, and linux is used at all levels both as servers and workstations. The number of Linux users is only growing, so you may want to adjust your thinking.

      1. I think you miss-read my reply. That was my point EXACTLY. I also work for a fortune 100 company and it is heavily used. My point was that even if you don’t use it at the workstation level, you ARE using it while going to most web sites.

  1. @ Kutzooi,
    If you don’t like, don’t read. Or you can learn something else, just be curious.
    Just think that Android is based on Linux, Kindle tablet, etc…
    I think many use Linux, they just don’t know !

  2. I do know that “rm -rf .” will delete everything it can. If you are root, it *will* kill your system.

    Don’t ask me how I know this. I have the scars…

  3. For some reason a list like this gives me a burning desire to load up Debian in a vm or on an old laptop and try a few of them..

  4. Windows usage is over 80%.
    Linux and its zillion variants usage (including servers around the world) is around 5%.
    So Kutzooi was not exactly right, but close!

    No offense to UNIX and its derivatives, I have used it in the 1980s and 1990s on engineering workstations (when PC’s weren’t powerful enough to handle certain engineering applications).
    I also keep a Linux live thumb drive for just in case I need to boot from it. Other than that, I’m no longer interested in any UNIX related OS. I never even liked it. It’s one of the OS’s that you either love it or hate it.

    It’s true that some servers are Linux/UNIX-based, but these are transparent to the end user.
    You click on a link in the browser, and it takes you to your destination, although the process may pass a number of servers with different server OS’s on its way.

    I’m done with commands. In the 1980s, while in college, I memorized the DOS commands, and very much the DOS manual, cover to cover!
    I’m happy using Windows. It’s simply my choice.

    To each their own, and we really shouldn’t get very defensive about it!

    See the share of various operating systems here, if in doubt (they have been compiling since 2003):

    1. “See the share of various operating systems here”
      The statistics you quote are for O/Ss that have accessed the w3sschools site, not for world-wide share by various operating systems.

      As w3schools disclaimer at the bottom of the statistics page states “Statistics can be misleading.”

  5. Actually w3’s report has the highest percentage for Linux.
    It’s a lot less here, just a little over 1.5%:
    Also, much more details are here, on Wikipedia (AT&T reports less than 1% Linux OS on its huge networks):

    The point is not to present exact figures, but to get an idea about usage.
    Again, I’m not against an OS or the other. Like I said before, to each their own.

  6. No one with ANY clue about the Linux command line would ever run any of these either deliberately or accidentally (especially the fork bomb) with the possible exception of the rm command.

    Recursive rm is almost mandatory if you want to remove a deeply nested set of directories. You just have to be at the correct top directory – which should never be root! – and NAME the directory you want to remove, don’t rely on any tree positional indicator like the dot. The rule in any OS is always, “Say what you want to do, don’t imply it.”

    Anyone executing command line code from elsewhere without at least some concept of what it does is on a par with those who click blindly every popup they see in Windows…

    There is no such thing as “fool-proof”… :-)

    The most dangerous thing I’ve done on Linux is enable the delete-without-recovery right-click option in Dolphin (i.e., delete without saving to the trash bin.) That HAS bitten me a couple times but I’m very careful about looking before I click on something.

  7. Why is the best command in linux included, the all-mighty “cat /dev/urandom > /dev/sda” ??

  8. mv ~ /dev/null
    does not works because you can’t overwrite a file with a folder.

    But this is dangerous:
    # dd if=/dev/urandom of=/dev/
    # dd if=/dev/urandom of=/dev/tty creates a mess in the terminal :)

Comments are closed.