description | wrapper around the rm command to prevent accidental deletions |
homepage URL | https://launchpad.net/safe-rm |
owner | francois@fmarier.org |
last change | Sat, 5 Sep 2020 20:07:24 +0000 (5 13:07 -0700) |
URL | git://repo.or.cz/safe-rm.git |
https://repo.or.cz/safe-rm.git | |
push URL | ssh://repo.or.cz/safe-rm.git |
https://repo.or.cz/safe-rm.git (learn more) | |
bundle info | safe-rm.git downloadable bundles |
content tags |
prevention of accidental deletions by excluding important directories
Copyright (C) 2008-2020 Francois Marier <francois@fmarier.org>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Once you have installed safe-rm on your system (see INSTALL
), you will need to
fill the system-wide or user-specific exclusions with the paths that you'd like
to protect against accidental deletion.
The system-wide exclusions live in /etc/safe-rm.conf
(or /usr/local/etc/safe-rm.conf
)
and you should probably add paths like these:
/
/etc
/usr
/usr/lib
/var
The user-specific exclusions live in ~/.config/safe-rm and could include things like:
/home/username/documents
/home/username/documents/*
/home/username/.mozilla
If you want more protection than what safe-rm can offer, here are a few suggestions.
You could of couse request confirmation everytime you delete a file by putting this in your /etc/bash.bashrc:
alias rm='rm -i'
But this won't protect you from getting used to always saying yes, or from accidently using 'rm -rf'.
Or you could make use of the Linux filesystem "immutable" attribute by marking (as root) each file you want to protect:
chattr +i file
Of course this is only usable on filesystems which support this feature.
Here are two projects which allow you to recover recently deleted files by trapping all unlink(), rename() and open() system calls through the LD_PRELOAD facility:
There are also projects which implement the FreeDesktop.org trashcan spec. For example:
Finally, this project is a fork of GNU coreutils and adds features similar to safe-rm to the rm command directly:
4 years ago | safe-rm-0.13 | New upstream release | tag | commitlog |
10 years ago | safe-rm-0.12 | commitlog | ||
10 years ago | safe-rm-0.11 | commitlog | ||
11 years ago | safe-rm-0.10 | commitlog | ||
11 years ago | safe-rm-0.9 | commitlog | ||
15 years ago | release-0.8 | commitlog | ||
15 years ago | release-0.7 | commitlog | ||
15 years ago | release-0.6 | commitlog | ||
15 years ago | release-0.5 | 0.5 release | tag | commitlog |
16 years ago | release-0.4 | commitlog | ||
16 years ago | release-0.3 | commitlog |
4 years ago | master | logtree |