Just DON'T!
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!!!
Base example everyone knows
Section titled âBase example everyone knowsârm
wonât let you just remove the root unless you provide the --no-preserve-root
flag e.g.
sudo rm -fr --no-preserve-root /
Glob patterns
Section titled âGlob patternsâ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.
sudo rm -fr /*
Victim of sudo
Section titled âVictim of sudoâDepending on what you have done recently in your shell session, you donât
even need to provide sudo
e.g.
sudo echo 'henlo fren'rm -fr /*
Installation
Section titled âInstallationâLinux apt
Section titled âLinux aptâRequires apt repository to be registered
sudo apt install dontrm
Using installation script
Section titled âUsing installation scriptâ-
Execute the installation script. By default should install to
/usr/bin
Terminal window curl -fsSL https://fuabioo.github.io/dontrm/install.sh | bash -
Verify your installation.
Terminal window dontrm version -
(Optional) Replace
rm
withdontrm
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
Disclaimer
Section titled âDisclaimerâ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