方式一:本身编写脚本git
编写脚本del.shgithub
#!/bin/bashvim
TMP_DIR="/tmp/trash_tmp"bash
mv $@ $TMP_DIRide
chmod +x /home/scripts/del.shspa
mkdir -p /tmp/trash_tmp命令行
chmod 777 /tmp/trash_tmprest
vim .bashrccode
alias rm='sh /home/scripts/del.shorm
source .bashrc
若是须要使用系统默认的rm,只要用\rm便可
方式二:安装trash
执行easy_install trash-cli
安装trash-cli,实现命令行下的回收站。项目见-trash-cli
trash-put trashes files and directories. trash-empty empty the trashcan(s). trash-list list trashed file. trash-restore restore a trashed file. trash-rm remove individual files from trash can.
alias rm='echo "This is not the command you are looking for, Please Use "trash"!!!"; false'