sudo rm -rf /

229 points · 13 comments · view on lemmy.world

13 Comments

stoy@lemmy.zip · 35 pts · 25d (9 replies)

Don't you have to pass the --no-preserve-root flag for this to work these days?

second@feddit.uk · 20 pts · 25d (7 replies)

Or use /* for the path so it globs to all directories under / whilst not triggering the logic which requires --no-preserve-root.

hayvan@piefed.world · 34 pts · 25d (4 replies)

Yes, that's how I nuked my workstation once. Part of my development routine was running sudo rm -rf $SDCARD/*. Guess what happens when SDCARD isn't defined.

pivot_root@lemmy.world · 9 pts · 25d (1 reply)

set -u is your friend. Unless you're running that command interactively, in which case it just exits the shell without giving any warning at all. Oh, the joys of shells written to be compatible with scripts created 20 years ago...

hayvan@piefed.world · 6 pts · 25d

It was interactive, but thanks, killing the shell is still better than reinstalling the machine.

Zarobi@aussie.zone · 6 pts · 25d

Even Steam did this once...

veroxii@aussie.zone · 4 pts · 25d

Nice!

Sylvartas@lemmy.dbzer0.com · 3 pts · 25d (1 reply)

Shouldn't it be /*.* for proper nuking or is that unnecessary ? I was told some hidden files would be ignored without it

poolcritter@pawb.social · 1 pts · 24d

shopt -s dotglob

Homo_Erectus@lemmy.zip · 19 pts · 25d

Yeah, but it wouldn't fit in the speech bubble =P

balderdash9@lemmy.zip · 4 pts · 25d

Don't try this at home kids

WereCat@lemmy.world · 3 pts · 25d

I did this accidentally on my TrueNAS when I was tired and troubleshooting something after midnight… luckily I had a backup

Kimika@lemmy.world · 2 pts · 24d

For those with a full or partial "huh?"

https://linuxstans.com/sudo-rm-rf/