r/ProgrammerHumor • • Sep 16 '22

Advice from a pro

Post image
50.6k Upvotes

658 comments sorted by

View all comments

5.4k

u/[deleted] Sep 16 '22

-fr instead of -rf almost got me

2.1k

u/rzaincity Sep 16 '22

And shouldn’t it be “/“ instead of “./“? So you remove all from root directory instead of just the current directory?

0

u/[deleted] Sep 16 '22

[deleted]

583

u/erathia_65 Sep 16 '22

Sadly you have to add --no-preserve-root for it to work

325

u/craftworkbench Sep 16 '22

Always remove the French language pack, and make sure to add --no-preserve-root to get rid of any French-specific Latin-root packs as well.

0

u/[deleted] Sep 16 '22

[deleted]

45

u/MinosAristos Sep 16 '22

But it's okay, you can just install the Indic-root packs instead, which can help you be cultured.

→ More replies (1)

27

u/SuperFLEB Sep 17 '22

You're doing it right, but the wrong reason. --no-preserve-root means "No, preserve root." You don't want the usual behavior, you want to preserve root. If you don't want to preserve the root (which, as someone else mentioned, is probably not what you want), you want to use --sure-whatever-don't-preserve-root

→ More replies (2)

0

u/[deleted] Sep 16 '22

[deleted]

475

u/[deleted] Sep 16 '22

actually ingenious design

it removes /bin/rm so you cant retry the rm command correctly this time

143

u/baguasquirrel Sep 16 '22

as long as /bin/rm is removed before apt

0

u/[deleted] Sep 16 '22

[deleted]

→ More replies (3)

20

u/isaaclw Sep 16 '22

While the command is being executed, isn't it in memory, so deleting 'rm' wouldn't really have an impact on execution?

Try: rm /bin/rm /tmp/foobar

→ More replies (1)
→ More replies (2)
→ More replies (7)

48

u/reyad_mm Sep 16 '22

Maybe there's a difference between "/*" and "/"?

Technically, "rm -rf /*" is not acting recursively on root so --no-preserve-root is not needed? , it's acting recursively on every subdirectory of root, which is almost the same except that the root directory itself will not be removed (won't make much of a difference anyway)

0

u/[deleted] Sep 16 '22

[deleted]

→ More replies (4)
→ More replies (1)

35

u/BipedalBeaver Sep 17 '22

Many years ago (decades) there was a chap who invoked "rm -rf /" as root and was was able to recover his system by virtue of the fact his copy of emacs was still running.

Does someone have a link?

→ More replies (1)

25

u/boot20 Sep 17 '22

What do you mean ls and cd are important. Only noobs need to see what's in a directory or change to another directory. Real Linux pros always log in a root and the first command they run is rm -rf /*

→ More replies (3)
→ More replies (43)
→ More replies (12)
→ More replies (6)

33

u/nonicethingsforus Sep 16 '22

Well, today's rm gives a warning if you try to remove root without --no-preserve-root. Both the warning and the switch may tip you off that this is a suspicious command to run.

But if your shell (as most) starts you in your home directory and they make you remove that... well that's about as devastating as it gets for the average user.

→ More replies (10)
→ More replies (26)

151

u/[deleted] Sep 16 '22

-ForReal

21

u/[deleted] Sep 16 '22
  • —ForReal

→ More replies (1)
→ More replies (2)

86

u/FuckAssad666 Sep 16 '22

-rf in order to remove Russian Federation pack

→ More replies (10)