Author Topic: Is there any legitimate use case for "rm -rf /"?  (Read 1140 times)

0 Members and 1 Guest are viewing this topic.

Offline davidgray

  • Jr. Member
  • **
  • Posts: 1
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Is there any legitimate use case for "rm -rf /"?
« on: January 10, 2020, 10:28:27 am »
This is not a support request, so mods please don't delete this. I was just curious about this so I asked.

Is there any legitimate reason to use rm -rf /? If so under what condition would you want to do so?

The reason I ask is that rm -rf / will destroy your root file tree only if if you provide a --no-preserve-root argument. But if using it is so dangerous, why not disallow the command from deleting root altogether?

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1433
  • Karma: 10021
  • Gender: Male
    • View Profile
    • Awards
Re: Is there any legitimate use case for "rm -rf /"?
« Reply #1 on: January 15, 2020, 08:39:13 pm »
Hi David,

I once watched a gobby consultant type in "rm -rf /*" on the console of an IMB RS6000 running AIX, in front of a client, while bragging about how the UNIX system was so great it could withstand such a command. I cautioned him (in front of said client) not to press return, a caution that was met with much displeasure and an insistence that of course he would not actually press return .. at which point he did in fact, accidentally press return.

I immediately left the building, however I did hear that he was on-site for the following three days and never returned to our office (!)

In general it's Linux's job to do what it's told and the user's job not to be an idiot careless.  ;)  .. there are always special cases, but you never know when someone might actually want to do something that you think they shouldn't .. Off the top of my head, I think you can mount an overlay filesystem on top of "/", which is how "live CD" systems used to work .. in which case "rm -rf /" should strip any changed files from your system (?) leaving it running on the underlying (possibly read-only) file-system .. or if you mount "/" read-only, "rm -rf /" might remove any RW files from non-root mount points. (although I've not tried it)

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal