13

Some answers on superuser, such as this one - https://superuser.com/a/1136881/7561 - include using the unix command of sudo rm /something - which could be extremely dangerous - as if a user didn't finish copying the command and just wrote sudo rm / and then clicked "enter" they will lose all of the data on their computer.

What is the best, safest way, to instruct people on how to use rm in a stack exchange answer?

15

That answer is a great example of how to do it - you're explaining what you're doing and what you're deleting step by step. We can't really completely stop people from accidentally their own system.

rm isn't inherently dangerous - many modern rm implementations are designed to stop you from hoisting yourself on your own petard. I mean you could use rm -i in your answers or reference one of the suggestions here.

That said, if someone wants to break open the gun locker, grab a bullet from a locked drawer, load and fire a shot right into his own foot, there's precious little we can do.

  • 7
    "if someone wants to break open the gun locker" - a better analogy for telling non-technical users to use "sudo rm" is handing them a gun and telling them to use it, without having passed any weapons handling training to make sure they don't shoot themselves in the foot by mistake. – Danra Oct 22 '16 at 7:57
  • Oh, it quite literally is more difficult than that to rm -rf / - see my first link. You literally need to explicitly tell it to delete the root directory of a system – Journeyman Geek Oct 22 '16 at 7:59
  • The guy in the third link you've attached wasn't saved by the safeguards :( although he also made use of an asterisk. In any case, the point was just that non-technical users don't want to do anything bad as your analogy suggests, just that they might do so by accident. – Danra Oct 22 '16 at 8:19
  • Btw, this is what accidentally their own system means for those not accustomed to the meme. – Qix Oct 22 '16 at 9:52
  • 3
    Reminds me of a comment asking: How do you even type --no-preserve-root accidentally? – kasperd Oct 22 '16 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .