linux修改rm指令執行(數據安全)

引用文章A:http://hi.baidu.com/jlusuoya/item/32ae398958088755840fabfbbash

引用介紹:將rm替換爲mv。.net

引用文章B:http://blog.csdn.net/qiudakun/article/details/6659072blog

引用介紹:在rm刪除文件後,如何恢復。我的還未常識。it

 

最近兩週由於誤操做刪除來兩次代碼。但由於時間比較緊,就直接從新寫了,而沒有使用恢復功能。file

1:詳細方法能夠參考引用文章A。引用

2:編輯路徑cd ~/.bashrc方法

3:文件末尾添加代碼:刪除文件

#replace rm with mv, use trm to run true rm
trash()
{
mv $@ ~/.local/share/Trash/files  #注意,這裏能夠自行定義。長時間刪除文件後,記得清空此文件夾。文件

}時間

alias trm="/bin/rm"

alias rm=「trash」

4:從新加載.bashrc : source .bashrc

相關文章
相關標籤/搜索