Skip to content

Just DON'T!

Avoid messing up your system like a clown 🤡

It is often said that Linux gives you the power to do ANYTHING you want. That is quite literally true. You might think that the rm command prevents you to remove the system root, which is more or less true. Even if you cancel the command 0.5 seconds after it began it is already too late.

This tool will help you prevent you from f****ng yourself. As I have done many times in the past.

Here are some examples:

⚠️ THESE WILL DESTROY YOUR SYSTEM!!!

rm won’t let you just remove the root unless you provide the --no-preserve-root flag e.g.

malicious-shell-script.sh
sudo rm -fr --no-preserve-root /

However, you might not know that /* actually resolves differently. It resolves in all the contents using a glob pattern and thus it won’t be protected by the lack of --no-preserve-root flag.

super-duper-malicious-shell-script.sh
sudo rm -fr /*

Depending on what you have done recently in your shell session, you don’t even need to provide sudo e.g.

hyper-malicious-shell-script.sh
sudo echo 'henlo fren'
rm -fr /*

Requires apt repository to be registered

Terminal window
sudo apt install dontrm
  1. Execute the installation script. By default should install to /usr/bin

    Terminal window
    curl -fsSL https://fuabioo.github.io/dontrm/install.sh | bash
  2. Verify your installation.

    Terminal window
    dontrm version
  3. (Optional) Replace rm with dontrm in your shell configuration (e.g. .bashrc .zshrc). This can be done by either an alias (for humans using terminal) or a function (if you want scripts to also be affected by this).

    Terminal window
    alias rm="dontrm"
    Terminal window
    rm() {
    dontrm $@
    }
    Terminal window
    rm version

This is only a rm wrapper, under the hood it only validates the input to prevent any accidental removal that would normally pass without trouble on rm. The only difference added to the CLI is that a new version command was added to:

  • Give visibility of what version you have installed (obviously)
  • If you have the alias, to give you the means to verify it as well