Results 1 to 7 of 7

Thread: What would be the result of a "sudo rm -r /"?

  1. #1
    Join Date
    May 2013
    Beans
    0

    What would be the result of a "sudo rm -r /"?

    Hey, so I have a question just out of curiosity. I have a dual-booted laptop, running Windows 7 and Ubuntu 12.04. What would happen if I entered the command "sudo rm -r /"? Obviously my whole Linux system would be gone. But, would this affect my Windows partition at all? Would the boot loader still be there? If not, would it be easy to reinstall the windows boot loader? Overall, is this overall just a horrible idea, or is it an option for wiping my Linux partition?

  2. #2
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: What would be the result of a "sudo rm -r /"?

    I wouldn't suggest trying it. Probably the easiest and quickest way to wipe a Linux partition is to use gparted to do what you need.
    Last edited by cariboo; May 28th, 2013 at 05:21 AM. Reason: added link

  3. #3
    Join Date
    Nov 2011
    Beans
    2,336
    Distro
    Ubuntu

    Re: What would be the result of a "sudo rm -r /"?

    "rm -r /" will remove all the files and directories in the "/" directory. It will not remove the partition.

    Using gparted or any other partition editor to remove the partition will do just that, of course.

  4. #4
    Join Date
    Apr 2006
    Location
    Seattle
    Beans
    2,893
    Distro
    Ubuntu Development Release

    Re: What would be the result of a "sudo rm -r /"?

    Running it as-is will give you a notice saying you need "--no-preserve-root" (but don't try that anyway, typos are dangerous).

    If your Windows partition (or any other) is mounted, it will be erased as well, since `rm` operates down the file tree and doesn't care about filesystem boundaries. I know someone who took a backup of their system and ran "rm -rf /" on it while the backup drive was still mounted.

    tl;dr: don't do it

  5. #5
    Join Date
    Nov 2007
    Location
    UK
    Beans
    200
    Distro
    Ubuntu

    Re: What would be the result of a "sudo rm -r /"?

    I love the fact that Linux allows you the freedom to wipe your entire system with such a simple command. Linux assumes you're smart and you know what you are doing. As said above you could potentially wipe out all data on all partitions if you have everything mounted into the directory tree. If that were the case, then the result would be a shed load of tears...


    Cosmic

  6. #6
    Join Date
    Oct 2012
    Beans
    148

    Re: What would be the result of a "sudo rm -r /"?

    Quote Originally Posted by jpeddicord View Post
    Running it as-is will give you a notice saying you need "--no-preserve-root" (but don't try that anyway, typos are dangerous).

    If your Windows partition (or any other) is mounted, it will be erased as well, since `rm` operates down the file tree and doesn't care about filesystem boundaries. I know someone who took a backup of their system and ran "rm -rf /" on it while the backup drive was still mounted.

    tl;dr: don't do it
    Oh snap! Ha ha, that's terrible.

  7. #7
    Join Date
    Jul 2007
    Location
    Tāmaki Makau-rau, NZ
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: What would be the result of a "sudo rm -r /"?

    A few years back, there was a rash of booby-trapped deb packages with "cool themes" for you to install. Except they had no theme files in them – and had a post-install script containing "rm -rf /"...
    BACKUPS are unsexy — until you discover you should have done one yesterday.
    Spare your nerves and do one before you upgrade or install.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •