rm -rf Mint

What will ‘rm -rf /’ actually do to your Linux/BSD machine?

For expert users of Linux and other UNIX-like operating systems, the command line is where the action is. We (they) claim that stuff gets done faster and easier on the command line than pointing and clicking on a fancy graphical interface.

While that may, to a very large extend, be true, the command line can be a scary place for new users. What do you do at the command line if you do not know what command to type? That may account for why new users shy away from the command line.

Typing the wrong command can severely cripple your computer. A wrong switch or wrong option is all it takes. One command that I learned to avoid a long time ago, based on what experienced users told me, is rm -rf /. The rm command is what you use to remove or delete a file or directory. By itself, rm will delete a file. With the -r or -R option, it will recursively delete a directory. The -f option will force the action. So, you can imagine what rm -rf / could theoretically do to you your system. But will it?

Related Post:  How Artificial Intelligence is influencing the gaming world

I never really bothered to find out for myself until prompted by a response to a comment by a reader on this article. Here is what I learned.

Typing the command in PC-BSD generated the response shown in this image. No harm done.
rm -rf PC-BSD

Same in Fedora.
rm -rf Fedora

And in Linux Mint.
rm -rf Mint

So, typing rm -rf / will not play pacman with your data, unless you override the – -preserve-root option, which is the default. Note that typing the command with the – -no-preserve-root option as a standard user, will delete everything that you have permission to delete. That means almost everything in your home directory. As root, it will continue to chew up any file it encounters until your screen looks like the image below, eventually turning completely dark. Do not try it, unless you want to have a very, very bad day, or, like I did, on a test installation.
rm -rf Root

Related Post:  5 things to do that will boost the security profile of your smartphone

In the beginning, when dinosaurs roamed freely, it is likely that rm -rf / actually did screw up a computer. But that could only have been true if – -preserve-root is a recent addition to the command’s options.

Please share:
Tags: No tags

29 Responses

Add a Comment

Your email address will not be published. Required fields are marked *