centos建立回收站

开始
首先在自己家的目录创建一个文件夹用来保存删除的文件.recycling
mkdir -p ~/.recycling
修改.bachrc文件
vim ~/.bachrc
在bachrc文件中添加下面内容

alias rm=trash        
alias rl='ls ~/.recycling'  
alias ur=undelfile  
undelfile()  
{  
  mv -i ~/.recycling/$@ ./  
}  
trash()  
{  
  mv $@ ~/.recycling/  
}
cleartrash()  
{  
    read -p "Clear trash?[n]" confirm  
    [ $confirm == 'y' ] || [ $confirm == 'Y' ]  && /usr/bin/rm -rf ~/.recycling/*  
}

添加之后使用source命令使文件生效
source ~/.bachrc
命令使用方法:

#删除一个文件夹,helloworld下面的文件均被移到回收站中
$rm helloworld

#删除一个文件
$rm abc.txt

#撤销abc.txt
$ur abc.txt

#撤销helloworld文件夹
$ur helloworld

#列出回收站
$rl

#清空回收站
cleartrash

转载于:https://blog.51cto.com/12832314/2147124

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值