linux系统设置回收站

  • 编辑~/.bashrc文件
alias rm=trash
alias rls='mkdir -p /tmp/`date +%F`; ls /tmp/`date +%F`'
alias unrm=undelfile

undelfile()
{
mv -i /tmp/`date +%F`/$@ ./
}
trash()
{
mkdir -p /tmp/`date +%F`
mv $@ /tmp/`date +%F`/
}
fl()
{
read -p "Clear trash?[n]" confirm
[ $confirm == 'y' ] || [ $confirm == 'Y' ] && /usr/bin/rm -rf /tmp/`date +%F`/*
}
  • 使生效
source ~/.bashrc

如果你使用的是zsh,则对应的文件为~/.zshrc