PDA

View Full Version : my scariest terminal moment ever...



kyalee
January 12th, 2009, 04:19 PM
I've been trying to increase my terminal-fu and last night I was playing with regular expressions and the rename command.

Did you know that


rename -n "s/t//g" /*

yields


/boot renamed as /boo
/etc renamed as /ec
/initrd.img renamed as /inird.img
/initrd.img.old renamed as /inird.img.old
/lost+found renamed as /los+found
/mnt renamed as /mn
/opt renamed as /op
/root renamed as /roo
/tmp renamed as /mp


I'm guessing that the system wouldn't have allowed me to do that for real (or would have at least made me log in as root before I did something that stupid) but still. Thank goodness for the no action flag. :lolflag:

JillSwift
January 12th, 2009, 04:27 PM
Thank goodness for the no action flag.
Hip Hip to that! -n has saved my bacon repeatedly.

neil_kelli
January 12th, 2009, 04:28 PM
Wow, I don't have any idea what you just said lol

kyalee
January 12th, 2009, 04:36 PM
Hip Hip to that! -n has saved my bacon repeatedly.

*nods* I panic a little when I run rename without using it first. Not that I've screwed up yet, but I like to keep myself in the habit of putting that little -n in there first every time. Just in case. *g*