替代Linux下的rm命令
阿新 • • 發佈:2017-11-13
linux
方式一:自己編寫腳本
編寫腳本del.sh
#!/bin/bash
TMP_DIR="/tmp/trash_tmp"
mv $@ $TMP_DIR
chmod +x /home/scripts/del.sh
mkdir -p /tmp/trash_tmp
chmod 777 /tmp/trash_tmp
vim .bashrc
alias rm=‘sh /home/scripts/del.sh
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‘
替代Linux下的rm命令