How to install safe-rm.

UPDATE: Current instructions located HERE.
Please ignore the outdated below.

So, you're worried about accidentally wiping out your entire system or important directory by doing something like rm -rf / or rm -rf *

with safe-rm , it won't allow you to do that, you'll get something like:


$ rm -rf /
Skipping /

Here's how to install:


cd /usr/local/src
# get latest version here: http://www.safe-rm.org.nz/
wget http://launchpad.net/safe-rm/trunk/0.8/+download/safe-rm-0.8.tar.gz
tar xvfz safe-rm-0.8.tar.gz
cd safe-rm-0.8
# find out your $PATH;
echo $PATH # most systems should include /usr/local/bin, if not then select any other listed
cp /bin/rm /usr/local/bin/rm
mv /bin/rm /bin/rm-01
cp safe-rm /bin/rm
vi /etc/safe-rm.conf

Add this to your safe-rm.conf, or any other directories you don't want accidentally deleted:


/
/etc
/usr
/usr/lib
/var

Done.

NOTE: I wrote this how-to up, because the instructions by the author and other sites are pretty vague.

Tags: Server Linux