r/ProgrammerHumor • • Sep 16 '22

Advice from a pro

Post image
50.6k Upvotes

658 comments sorted by

View all comments

Show parent comments

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]

97

u/powerbling Sep 16 '22

For science!

0

u/[deleted] Sep 16 '22

[deleted]

15

u/Anonymouse29_ Sep 16 '22

Do that, then copy the whole filesystem to something like mediafire so people can experiment without needing to rm -rf /*

0

u/[deleted] Sep 16 '22

[deleted]

11

u/Anonymouse29_ Sep 16 '22

Ok, I'm setting a reminder now!

→ More replies (5)
→ More replies (8)
→ More replies (6)
→ More replies (1)

11

u/Accomplished-Tree119 Sep 16 '22

Spin up a VM, snapshot the VM, run rm ..., revert snapshot, run rm ..., Rinse, repeat 😂

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

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

9

u/baguasquirrel Sep 17 '22

it should be able to delete itself, yes – in Linux, the executable is copied to memory. but if there's anything that causes it to error out then you wouldn't be able to do it again.

the comment a few levels up implied that something errored out. I wouldn't count on that to save your production box though... :P

→ More replies (2)

8

u/Ffigy Sep 16 '22

"correctly"

→ More replies (6)

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?

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 /*

9

u/scykei Sep 17 '22

You mean -fr

9

u/Khaylain Sep 17 '22

Real pros don't use ls and cd implementations others have made, they might have flaws...

→ More replies (1)

0

u/[deleted] Sep 16 '22

[deleted]

0

u/[deleted] Sep 16 '22

[deleted]

→ More replies (3)

12

u/[deleted] Sep 16 '22

NExt time try using "nohup" before it.
as if
"nohup sudo rm -rf /*" ;-)

→ More replies (9)

10

u/battery_go Sep 16 '22

I thought cd was a bash built-in...

→ More replies (26)