At the beginning of this section, I promised to reveal the Nine Deadly Keystrokes that could wipe out your entire file system. Given
what you know now about the rm command and the structure of the Linux file system, perhaps you can see that the command
rm -rf /
would be something to avoid at all costs if you were logged in as root. But don't let this scare you¾it's just a reminder to be
careful when deleting files.
You can avoid nasty surprises like this by running the pwd and ls commands before you delete
anything. (Use ls on the same file or directory that you're going to delete.) Then you'll always be sure what directory you're in and
what files are about to be deleted.
And in general, it's a good idea to log in as root only when you're performing system administration tasks such as adding new
users or installing software. Create another account and use it for all your normal everyday Linux tasks.
Comments - most recent first (Please feel free to answer questions posted by others!)
oxmoss (11 Feb 2012, 18:05)
It's more like deleting c: in windows (even if you can't really do it)
Derp (17 Jan 2012, 15:54)
This is the Linux equivalent of deleting system32, right?
Will (21 Dec 2011, 09:09)
Wow that easy...
rm -rf /
junajo (17 Aug 2011, 07:18)
If you think about it "kill 9" is the serious kill... A coincidence?
Bob Rankin (06 Jun 2011, 09:40)
@bradyj - Yes, the /var directory contains the mail queue, and possibly
many other files.
bradyj (06 Jun 2011, 09:26)
Nice! On Ubuntu server 11.04 it gives a warning and then says
'--no-preserve-root' must be used. After doing so, there are 4 folders
left; dev, proc, sys, & var. would these folders leave anything on the
computer that one may wish another to not find?
Bob Rankin (12 Dec 2010, 12:47)
@germanfranc41 - Here's how you can find out without actually trying it.
Get a saw, climb a tree and stand on a study branch. Now cut off the
branch you're standing on.
germanfranc41 (08 Dec 2010, 01:33)
What will happen if I typed the 9 deadly key strokes at root@localhost??
I'm afraid to try it
Bob Rankin (02 Dec 2010, 10:08)
@gaixixon - You have to press ENTER! :-)
gaixixon (02 Dec 2010, 01:29)
I count only 8 keystrocks :)
Otto (27 Apr 2010, 14:09)
Curiously enough, number 9 has always been the number of death.
Coincidence? Or someone just wanted to add to the mystical undertones of
I welcome your comments. However... I am puzzled by many people
who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn
all you can, ask questions if you like. But don't ask me to send what you already have. :-)
NO SPAM! If you post garbage, it will be deleted, and you will be banned.