Linux Classes
Share This With a Friend  
LINUX CLASSES - FILES

What Are The Nine Deadly Keystrokes?

Don't Try This at Home

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.

Previous Lesson: Linux Files - Wildcards
Next Lesson: Linux File Permissions

[ RETURN TO INDEX ]


   

Comments - most recent first
(Please feel free to answer questions posted by others!)

Sarah     (21 Jan 2017, 09:18)
Is there any reason why:

sudo apt-get remove --purge alsa-base pulseaudio

sudo apt-get install alsa-base pulseaudio

sudo alsa force-reload

Would kill a Linux Mint 17? I tried this solution from another website, but all it ended up doing was making me unable to log in, and my session last less than 10 seconds.

I basically can't even reinstall Linux Mint.
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 Unix?

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.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:
 
 


Ask Bob Rankin - Free Tech Support


Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.