码迷,mamicode.com
首页 > 系统相关 > 详细

trash-cli设置Linux 回收站

时间:2019-02-18 19:05:49      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:hub   nts   包含   ref   etc   shell   ali   开发   通过   

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/

trash-cli设置Linux 回收站

标签:hub   nts   包含   ref   etc   shell   ali   开发   通过   

原文地址:http://blog.51cto.com/moerjinrong/2351347

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!