trash-cli 设置 Linux 回收站

trash-cli是一个使用 python 开发的软件包,包含 trash-put、restore-trash、trash-list、trash-empty、trash-rm等命令,我们可以通过这条命令,将文件移动到回收站,或者还原删除了的文件。

trash-cli的项目地址:https://github.com/andreafrancia/trash-cli

系统:CentOS 6.8

  • 安装
下载地址:https://github.com/andreafrancia/trash-cli
cd /tmp
unzip trash-cli-master.zip
cd trash-cli-master
python setup.py install

安装过程

[root@node1 trash-cli-0.17.1.14]# python setup.py install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/trashcli
copying trashcli/trash.py -> build/lib/trashcli
copying trashcli/list.py -> build/lib/trashcli
copying trashcli/empty.py -> build/lib/trashcli
copying trashcli/list_mount_points.py -> build/lib/trashcli
copying trashcli/rm.py -> build/lib/trashcli
copying trashcli/__init__.py -> build/lib/trashcli
copying trashcli/put.py -> build/lib/trashcli
copying trashcli/fstab.py -> build/lib/trashcli
copying trashcli/restore.py -> build/lib/trashcli
copying trashcli/fs.py -> build/lib/trashcli
copying trashcli/cmds.py -> build/lib/trashcli
running build_scripts
creating build/scripts-2.6
copying and adjusting trash -> build/scripts-2.6
copying and adjusting trash-put -> build/scripts-2.6
copying and adjusting trash-list -> build/scripts-2.6
copying and adjusting trash-restore -> build/scripts-2.6
copying and adjusting trash-empty -> build/scripts-2.6
copying and adjusting trash-rm -> build/scripts-2.6
changing mode of build/scripts-2.6/trash from 644 to 755
changing mode of build/scripts-2.6/trash-put from 644 to 755
changing mode of build/scripts-2.6/trash-list from 644 to 755
changing mode of build/scripts-2.6/trash-restore from 644 to 755
changing mode of build/scripts-2.6/trash-empty from 644 to 755
changing mode of build/scripts-2.6/trash-rm from 644 to 755
running install_lib
creating /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/trash.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/list.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/empty.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/list_mount_points.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/rm.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/__init__.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/put.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/fstab.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/restore.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/fs.py -> /usr/lib/python2.6/site-packages/trashcli
copying build/lib/trashcli/cmds.py -> /usr/lib/python2.6/site-packages/trashcli
byte-compiling /usr/lib/python2.6/site-packages/trashcli/trash.py to trash.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/list.py to list.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/empty.py to empty.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/list_mount_points.py to list_mount_points.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/rm.py to rm.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/__init__.py to __init__.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/put.py to put.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/fstab.py to fstab.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/restore.py to restore.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/fs.py to fs.pyc
byte-compiling /usr/lib/python2.6/site-packages/trashcli/cmds.py to cmds.pyc
running install_scripts
copying build/scripts-2.6/trash-rm -> /usr/bin
copying build/scripts-2.6/trash-list -> /usr/bin
copying build/scripts-2.6/trash-put -> /usr/bin
copying build/scripts-2.6/trash -> /usr/bin
copying build/scripts-2.6/trash-restore -> /usr/bin
copying build/scripts-2.6/trash-empty -> /usr/bin
changing mode of /usr/bin/trash-rm to 755
changing mode of /usr/bin/trash-list to 755
changing mode of /usr/bin/trash-put to 755
changing mode of /usr/bin/trash to 755
changing mode of /usr/bin/trash-restore to 755
changing mode of /usr/bin/trash-empty to 755
running install_data
copying man/man1/trash-empty.1 -> /usr/share/man/man1
copying man/man1/trash-list.1 -> /usr/share/man/man1
copying man/man1/trash-restore.1 -> /usr/share/man/man1
copying man/man1/trash-put.1 -> /usr/share/man/man1
copying man/man1/trash-rm.1 -> /usr/share/man/man1
running install_egg_info
Writing /usr/lib/python2.6/site-packages/trash_cli-0.17.1.14-py2.6.egg-info
[root@node1 trash-cli-0.17.1.14]#
  • 安装成功后我们的系统就有了以下工具.
[root@node1 ~]# ll /usr/bin/|grep trash
-rwxr-xr-x    1 root root        123 2月  18 15:26 trash
-rwxr-xr-x    1 root root        125 2月  18 15:26 trash-empty
-rwxr-xr-x    1 root root        124 2月  18 15:26 trash-list
-rwxr-xr-x    1 root root        123 2月  18 15:26 trash-put
-rwxr-xr-x    1 root root        127 2月  18 15:26 trash-restore
-rwxr-xr-x    1 root root        122 2月  18 15:26 trash-rm
[root@node1 ~]#
  • 功能说明
命令概览:trash-put          将文件或目录移入回收站trash-empty        清空回收站trash-list         列出回收站中的文件trash-restore      还原回收站中的文件trash-rm           删除回首站中的单个文件
  • 用它替代 rm命令
[root@node1 ~]# vim /etc/.bashrc
# 添加下面一行
alias rm=”trush-put”

使修改的别名生效:

[root@node1 ~]# source /etc/bashrc

默认存放路径:/~/.local/share/Trash/files/

转载于:https://blog.51cto.com/moerjinrong/2351347

trash-cli设置Linux 回收站相关推荐

  1. linux的垃圾箱是哪个文件夹,Ubuntu命令行的垃圾箱Trash CLI,远离 rm 命令误删除重要文件的阴影...

    原标题:Ubuntu命令行的垃圾箱Trash CLI,远离 rm 命令误删除重要文件的阴影 作为Linux用户,您可能需要不时从系统中删除文件.我们在删除文件时往往会保持谨慎,特别是在永久删除文件时, ...

  2. Linux回收站的设计与实现

    作为Linux系统管理员或者软件开发人员,当你使用rm命令删除文件之后发现该文件依然有用但无法恢复,或者使用 'rm -rf'强制误删了某些文件时,是否为此感到痛苦不堪.是否苦恼于Linux缺乏类似W ...

  3. 101个脚本之linux回收站

    众所周知,linux是没有回收站的,一些人很害怕删错东西(有经验的linux管理员极少范这错误),个人不建议回收站,而应该是培养个人的安全意识.有点小跑题. 接着回来101个脚本之#15 Archiv ...

  4. vue cli3 绑定域名_使用CLI设置WildFly绑定地址并关闭

    vue cli3 绑定域名 仅使用命令行参数将WildFly绑定到主机名/ IP上非常容易. 我有一个简单的GNU / Linux盒子,可以用它玩各种东西,其中之一就是WildFly. 我使用以下命令 ...

  5. 使用CLI设置WildFly绑定地址并关闭

    仅使用命令行参数将WildFly绑定到主机名/ IP上非常容易. 我有一个简单的GNU / Linux盒子,可以用它玩各种东西,其中之一就是WildFly. 我使用以下命令开始在特定IP上监听Wild ...

  6. linux回收站空间,打造linux回收站功能

    前言:其实今天我是很忙的,不过内心总感觉有些事情必须要做.前两天一哥们把线上环境一个web节点的/给删除了,昨天一哥们又把mysql的data目录给删除了.试想一下,如果没有做全网备份,如果不是一个节 ...

  7. 设置linux初始root密码

    简单一步设置linux第一个root密码 sudo passwd root #输入当前账户密码 #输入准备设置的root密码 #确认密码 如下所示:

  8. 如何设置 Linux 上 SSH 登录的 Email 提醒

    如何设置 Linux 上 SSH 登录的 Email 提醒 虚拟私有服务器 (VPS)上启用 SSH 服务使得该服务器暴露到互联网中,为黑客攻击提供了机会,尤其是当 VPS 还允许root 直接访问时 ...

  9. python脚本设置linux环境变量_Linux环境变量export方法与修改文件方法的区别

    玩蛇网推荐图文教程:python 列表 要想修改Linux环境变量有两种方法可以实现,但是关于Linux环境变量export方法与修改文件方法的区别你又了解多少呢?设置 Linux 环境变量可以通过 ...

最新文章

  1. 【转】ubuntu下实用的三款录屏软件
  2. oracle空间管理
  3. Python 字符串按固定长度拆分
  4. [Android]你不知道的Android进程化--进程信息
  5. 机械臂中的四元素转为旋转矩阵_雅克比矩阵(上)雅克比推导
  6. 阿里巴巴基于Java容器的多应用部署技术实践
  7. c语言有一对兔子结果,c语言编程,求兔子问题。
  8. 动态水印跟踪去除_PS教程:怎么去除gif动态图片中的水印文字
  9. error Target dll has been cancelled debugger aborted
  10. 教师资格证面试试讲需要注意什么?
  11. 2021-11-09水洗碳带有什么特点
  12. Auto CAD:将CAD三维实体转为三视工程图(俯视图、正视图、左视图)的图文教程之详细攻略(建议收藏!!)
  13. Kotlin-Android世界的一股清流
  14. Princeton Algorithms, Boggle
  15. badou大数据 五期
  16. Caffe2 - (十)训练数据集创建
  17. css3加载中loading代码js特效大全
  18. 使用奥维地图加载星图地球数据云地图数据
  19. 《Natural Language Processing with Transformers》中示例
  20. 关于思考和深度思考的真相

热门文章

  1. Windows上通过VLC播放器搭建rtsp流媒体测试地址操作步骤
  2. C++中extern C的使用
  3. Sobel算子及cvSobel
  4. python目标检测与识别_Python 使用Opencv实现目标检测与识别的示例代码
  5. 双显卡单独分辨率_CPU、GPU双重碾压!AMD RX 6000系列显卡正式发布 16G显存吊锤RTX 30...
  6. mac上mysql关闭不了了_python操作mysql数据库
  7. mybatis 一对多_MyBatis面试题集合,90%会遇到这些问题
  8. html css 显示数值_【CSS纯技术】20.03.05-CSS渲染的原理
  9. Java中的自动装箱和拆箱
  10. ios app内嵌入http服务器