Alternatively use safe-rm rm command, to prevent accidental deletion

1. Download safe source package:

wget https://launchpad.net/safe-rm/trunk/0.12/+download/safe-rm-0.12.tar.gz

 

2. Extract safe-rm

takes -zxf safe-rm 0.12.tar.gz

 

3. Copy to the safe-rm / usr / local / bin directory

cp safe-rm-0.12/safe-rm   /usr/local/bin/rm

 

4. Add the environment variable

vim /etc/profile 

# Add the last line

PATH=/usr/local/bin:$PATH

After saving it into effect

source /etc/profile

 

The configuration path blacklist

vim /etc/safe-rm.conf

# Add a path separator to remove a row

/

/*

/xxx/xxx

/root/test

 

6. Test delete the test folder

mkdir /root/test

rm -rm /root/test

 

Guess you like

Origin www.cnblogs.com/yueminghai/p/11262656.html