您的位置:首页 > 其它

Easy way to prevent accidental deletion under ubuntu

2018-02-20 11:53 417 查看
As it happens many many times, people under cmd mode, use 'rm -rf' so unfetteredly including me...  And I finally realized it's better to make some adjustment.  
Most of the time, I see ppl alias rm='rm -i' , which can be a good idea, while I would prefer alias rm='gvfs-trash' under ubuntu.  Also other more sophisticated ways exist.   If opt to rm='gvfs-trash', the '-rf' would be useless and unrecognizable to the shell.
To only put alias rm='gvfs-trash' in the cmd line cannot be enough as after reboot it would be gone.  Better way is to add it into the .bashrc file.



Also it's better to add one additional alias, and that is alias sudo='sudo ', so it would work when "sudo rm filename".
/home/user/.bashrc:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  alias rm