linux alias rm 避免误操作删除重要文件

来源:互联网 发布:如何确保数据安全 编辑:程序博客网 时间:2024/06/14 01:26
#安全rm#{{{
alias r=trash    
alias rl='ls ~/.trash'  
alias ur=undelfile  
undelfile()  
{  
      mv -i ~/.trash/$@ ./  
}  

trash()  
{  
   mv $@ ~/.trash/  
}  

cleartrash()  
{  
    read -p "clear sure?[n]" confirm  
    [ $confirm == 'y' ] || [ $confirm == 'Y' ]  && /usr/bin/rm -rf ~/.trash/*  
}

#}}}





文件系统check                        fsck   -ARCfsc  /