Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Do any Linux distros prevent the execution of sudo rm -rf /* so that people do not accidentally delete their hard drives if they did not know what they are doing?

share|improve this question
Shoot. that's a cron job of mine. Keeps the box virus free! :) – kobaltz Aug 8 '13 at 20:59
up vote 9 down vote accepted

No; you are expected to know what you are doing. Look on the bright side! You almost certainly won't shoot yourself in the foot more than once.

share|improve this answer

The answer is not by default.

Let me add that the risk can be more subtle than your bare-bones example. Take this example:

[user@server ~]$ sudo rm -rf directory_to_delete /*

The accidental space between the directory_to_delete and the /* means that it's going to operate on both the directory_to_delete and /*, the root folder, as the root user. And it's going to do it recursively, so there goes your OS install.

That's why you need to be extremely careful when using rm -rf, especially with sudo.

share|improve this answer

You must log in to answer this question.

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