摘要:看到rm 就害怕,再加个-rf就能吓死人, 呵呵如果你再加个* 号,手一抖再加个空格 .让你体验一把一无所有的感觉.
1.打开.bashrc (最好进入root,在etc/profile文件加入代码,对整个系统有效,不仅仅是root)
vim ~/.bashrc
vim /etc/profile
2.增加如下代码:
alias RM='/bin/rm -i'
alias rm=deletecmd
alias rml='ls /delete'
alias urm=undelfile
undelfile()
{
mv -i /delete/$@ ./
}
deletecmd()
{
mv $@ /delete
}
cleardel()
{
read -p "clear sure? 'Y' is confirm, 'N' is cancel" confirm
[ $confirm == 'y' ] || [ $confirm == 'Y' ] && /bin/rm -rf /delete/*
}
应用:执行source ~/profile 或者 source ~/.bashrc
3. RM代替rm 命令,然后执行删除时,提示确定.
4.rml 打开回收站.
5.urm filename 恢复filename
6.cleardel 清空回收站.
当然 如果不小心酿成大错,请移步:rm删除文件还原