I know that this is a very dangerous command, but what does it actually do. In other words, to what extend does it delete the hard drive. Does it delete only the user data? Or does it delete root OS files as well. If someone were to activate this command, would it break the OS? Running as sudo on Yosemite

  • 3
    possible duplicate of Legendary sudo rm -rf /
    – Scot
    Aug 16 '15 at 4:18
  • It's going to depend quite a bit on whether you run the command as root (i.e. with sudo), as an administrator, or as a standard user. It'll also depend on which version of OS X you're using -- IIRC there was at least one version where rm failed as soon as it'd taken out /bin for some reason. On the other hand, when run as root under OS X Yosemite, the destruction is impressively complete. Aug 16 '15 at 4:26

The command itself is "rm", which is a program used to remove a file.

The "-rf" is the first argument to the program. Arguments can be thought of as "settings" or other information that you want the program to use while performing its task.

"-rf" is really a short hand for two seperate arguments, "-r" and "-f":

-r means that you want the program to not only remove files, but also directories, and that you want the program to remove not only the files/folders that you request, but also any subfolders and their contents.

-f means that you do not want to be prompted for confirmation on each delete, and that attempts should be made to delete every file/folder listed, no matter if you have permissions to do so orr not.

The last part of the command "/" is actually the list of what you want the program to delete. In this case "/" means the "root" (the top) of the file hierarchy. In practice this means to do delete everything on your system - including files on external drives that may be mounted.

The command does not discriminate between user data or operating system files. As long as you have permissions to delete a file/folder, it will be deleted.

When run as sudo (i.e. with root permissions) under Yosemite, it will break the system so that it doesn't function afterwards.

For newer versions of macOS, destruction will be limited by the SIP system that protects the operating system core. However, still do not run the command with sudo, as you risk ruining the system and deleting your own data.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .