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?
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.
Same in Fedora.
And in Linux 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.
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.
Digital Ocean is a VPS/Cloud hosting provider. For just $5 per month, you can get yourself a Cloud server with 512 MB of RAM, 20 GB super-fast SSD, free snapshots, plus backups for a minimal fee. All via a simple graphical interface.
And by signing up with this referral link, you can help support this website.
If you are reading this, your ad could also be occupying this space. Contact us to make it happen.