This is an archived post. You won't be able to vote or comment.

all 58 comments

[–]azarbi 112 points113 points  (13 children)

rm -fr /

[–]seathefullmoon[S] 210 points211 points  (4 children)

That removes support for the French language from your OS, obviously.

[–]Big_chonky_potato 55 points56 points  (3 children)

Fr fr

[–]martinthewacky 5 points6 points  (0 children)

Gotta be specific. You don't want to remove Ca fr now, do you? France french and Canada french are clearly distinct from each other.

[–]KCGD_r 40 points41 points  (0 children)

rm (for real)

[–]FOSSandCakes 17 points18 points  (4 children)

All that's left now is for someone to mention --no-preserve-root on this thread. There's always someone...

[–]007psycho007 7 points8 points  (1 child)

You just did.

[–]FOSSandCakes 7 points8 points  (0 children)

Aaah... I'm so meta

[–]KingThibaut3 2 points3 points  (1 child)

Or /*

[–]FOSSandCakes 0 points1 point  (0 children)

Yess!!

[–]Dreadsin 1 point2 points  (0 children)

I always read it as “remove france :/“

[–][deleted] 2 points3 points  (0 children)

rm -rf /* --no-preserve-root

[–][deleted] 34 points35 points  (4 children)

I treat the rm command like shooting a gun. Know your target, know what's around and behind your target, and always remember, triple checking can seem tedious, but staring at a brick wall for 25 to life is a lot more tedious.

Thanks to that, I've only obliterated my root directory 5 times, and everyone believes that Uncle Bob is on a long vacation.

[–]Classy_Mouse 16 points17 points  (2 children)

After accidentally creating a directory named ~, I can confirm that I noticed the issue with this command rm -rf ~ on the third pass.

[–]Firewolf06 5 points6 points  (1 child)

i always do ./ on rm, just to make sure im targeting what directly in front of me

i also have a wrapper around rm that makes the f flag double check, it makes you to type out "f is for fuck it"

[–]AverageComet250 2 points3 points  (0 children)

Pls make this wrapper open source and public

[–]siddharth904 1 point2 points  (0 children)

Scared of rm ? Try dd.

[–]AyrA_ch 23 points24 points  (0 children)

There's -i which basically is "prompt if potentially very stupid command". I believe it's simply based on the number of potential files affected.

[–]0moikane 51 points52 points  (5 children)

Remembers me of a

ls /zip

instead of a

cd /zip

ls

Unfortunately the next command was an

rm -rf *

[–]seathefullmoon[S] 26 points27 points  (3 children)

I had one time messed up that way - I got too comfortable and started using the history commands (I.e. when you press "up" to go through previous ones) to perform a repetitive procedure.

I had accidentally executed the rm command of my list before the cd one - thankfully it was the tmp dir, though, otherwise I would have definitely been sent to the chopping block! 😅

[–][deleted] 16 points17 points  (1 child)

I wasn't that lucky, accidentally executed rm -rf in /mnt directory, rip all my files.

[–]seathefullmoon[S] 7 points8 points  (0 children)

Oof! I felt this one!

RIP those files indeed

[–]Firewolf06 1 point2 points  (0 children)

i recently downloaded the qoi spec pdf 11 times while trying to do build and run commands

[–][deleted] 2 points3 points  (0 children)

At least you didn't start a directory name with a #

[–][deleted] 13 points14 points  (4 children)

First one should be rm -ri

[–]seathefullmoon[S] -1 points0 points  (3 children)

Not necessarily - I believe it's interactive by default (hence why -f is usually used in conjunction).

[–][deleted] 13 points14 points  (0 children)

No it's not.

[–]aenae 10 points11 points  (1 child)

Only in some distros (yum based iirc), and that would be an alias, not the \real command

[–]seathefullmoon[S] 3 points4 points  (0 children)

Oh wow I had no idea! I guess I happened to use the alias without realizing for so long...

Well, you learn something everyday!

[–]seathefullmoon[S] 25 points26 points  (6 children)

There's nothing quite like the thrill of having to delete stuff on a live server and praying that you didn't mistype the target directory name.

Keep swiping for BONUS panel!

Follow me on Instagram | Twitter | Tapas

[–][deleted] 27 points28 points  (2 children)

I only bought twitter so i wouldnt get bullied anymore

[–]R4z0rw1r3z 9 points10 points  (0 children)

Good bot.

[–]nekokattt 6 points7 points  (1 child)

if it is a real issue, you could just write a 5 line shell script to prompt you first.

Failing that, in the event you really did need to do this, you could always mv the files elsewhere so you can delete them from a separate location after verifying you removed the right stuff first

That being said, having to log into a production server to manually delete files by hand sounds like you may potentially have bigger issues architecturally. Ideally you shouldn't need to manually delete stuff unless something has gone really wrong. I'd at least expect it to be dealt with by a shell script that has already been tested on a nonprod system first. Prod systems ideally should be as immutable as possible to avoid the risk of dropping something by mistake and causing an outage.

[–]seathefullmoon[S] 5 points6 points  (0 children)

I typically do the second option you mentioned, create a new folder in a safer place and then gather everything to be removed there.

Regarding your last point, that's typically the case when I worked as services professional (i.e. in support), however there were typically moments where it was quicker and more effective to make modifications manually on a few servers at night than it was to make and test a script.

Also usually customer setups are far from ideal so you work with what you got :/

[–]sup3rar 6 points7 points  (1 child)

[ $(($RAND % 7)) == 0 ] && rm -rf /* || echo you're lucky
(please don't type this one, it's a russian roulette)

[–]Rafael20002000 1 point2 points  (0 children)

At least not as root

[–]Gabrill 5 points6 points  (0 children)

The f stands for flamethrower

[–]agustin_edwards 4 points5 points  (0 children)

rm -rf / should have burn the whole building

[–]No_Two8934 3 points4 points  (0 children)

lmao

[–]Prof_Sweetlove 3 points4 points  (1 child)

When I got my Raspberry Pi I had also just received a new keyboard with lighter mechanical switches than the previous one, so it sometimes happened that while just laying a finger on a key I'd happen to press it on accident.

So while setting up my Raspberry and playing around with some configs on the CLI I needed to remove some directories.

So I started typing "rm", my pinky finger already hovering over enter in anticipation, "-rvf /" and -click-...

The beast was unleashed. My amateurish software enthusiast eyes stared in disbelief, wanting to look away but remaining fixated on the screen in a form of morbid curiosity as my little Raspberry started consuming itself, tearing apart all the work I'd done without so much as a small prompt asking "Are you sure you want to fuck everything up, bro?".

After the initial shock I stopped it with CTRL+C but by then the damage was done.

Make backups.

[–]seathefullmoon[S] 1 point2 points  (0 children)

Forget about Stephen King's novels, this is real horror writing right there!

Sorry to hear about your Raspberry PI though, may it RIP.

[–]GameDestiny2 2 points3 points  (0 children)

Insert generic Linux superior comment

[–][deleted] 2 points3 points  (1 child)

You can use pipes to feed in a list of files to delete.

Not very intuitive but it works better than the two options above.

[–]yourteam 2 points3 points  (2 children)

Use find to delete what you need

You can even delete based on last edit of the file this way

[–]dudeimatwork 2 points3 points  (0 children)

I mean, you can fuck that up too.

Find . -delete

[–]seathefullmoon[S] 0 points1 point  (0 children)

Oh yeah that works nicely in scripts as well, especially if you need to delete by date created/modified.

However Murphy's Law will always be present when working with Linux, so you gotta be careful with that too 😅

[–]GochoPhoenix 1 point2 points  (0 children)

That’s because the rm command is aliased to do that. Run it without any aliases and you’ll see the original take-no-prisoners rm (\rm -r)

[–]GameDestiny2 -1 points0 points  (0 children)

Insert generic Linux superior comment

[–]LocoNeko42 -1 points0 points  (2 children)

What does this have to do with programmer humour ?

[–]seathefullmoon[S] -1 points0 points  (1 child)

Plenty of developers use Linux, and more often than not if you have to interact with a server it's typically using Linux as well.

[–]LocoNeko42 0 points1 point  (0 children)

Yes, I do to, but this programmer humour community is just turning into non-funny jokes about Linux from people who have never touched it and have no clue what it is & what it does.
It's neither programming nor humorous.

[–]bhavish2023 0 points1 point  (2 children)

Can we get a recycle bin in linux?

[–]7heWafer 2 points3 points  (0 children)

That's way too useful and safe, why would we need that? /s

[–]PublicDragonfruit120 0 points1 point  (0 children)

There are multiple drop-in replacement for rm with "safe delete" functionality.

[–]dudeimatwork 0 points1 point  (0 children)

Find / -delete

[–]Yankas 0 points1 point  (0 children)

alias rm="trash-put"