0%

Linux中安装trash-cli代替rm命令

rm -rf /的故事屡见不鲜
已习惯使用trash代替了rm命令
对一般文件的删除就相当于有了回收站功能
防患于未然吧

安装

1
2
sudo apt-get install -y python-pip
sudo pip install trash-cli

使用

command description
trash-put trash files and directories.
trash-empty empty the trashcan(s).
trash-list list trashed files.
trash-restore restore a trashed file.
trash-rm remove individual files from the trashcan.

rm别名

设置rm别名,加入~/.bashrc 或 ~/.zshrc

1
alias rm='echo "This is not the command you are looking for."; false'

一定要使用rm的时候

1
\rm file-without-hope

参考链接

trash-cli - Command Line Interface to FreeDesktop.org Trash
原文链接