admin 管理员组

文章数量: 1184232

在Linux上误删文件是一件很可怕的事,但是有trash-cli就不怕了

1.确定系统是否已安装Git

[root@localhost ~]# git --version
git version 1.7.1
[root@localhost ~]#

若没有安装则安装git

[root@localhost ~]# yum install git-core

2.将trash-cli克隆到本地
[root@localhost local]# git clone https://github/emanon-was/trash-cli.git /usr/local/trash-cli
3.配置环境变量
[root@localhost local]# export PATH=/usr/local/trash-cli/bin:$PATH
4.常用命令
删除文件 trash-put xxx.txt 查看回收站 trash-list 还原文件 trash-restore 清空回收站 trash-empty 删除回收站中文件 trash-remove xxx.txt
5.给rm创建别名,删除文件就进回收站
[root@localhost ~]# alias rm='trash-put'
[root@localhost ~]# alias rm
alias rm='trash-put'
[root@localhost ~]#

以后删除文件就可以用 rm xxx.txt 就直接移至回收站了,是不是很方便 测试一波:

最后感谢作者“emanon-was”提供工具,了解更多请参阅 https://github/emanon-was/trash-cli

本文标签: 回收站 工具 Linux