• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

Trash-cli – A Trashcan Tool to Manage ‘Trash’ from Linux Command Line

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
39
VIEWS
Share on FacebookShare on Twitter

Contents

  1. How to Install Trash-cli in Linux
  2. How to Use Trash-cli in Linux

Trash-cli is a command line interface that trashes files and records the original absolute path, deletion date, and associated permissions. It uses the same trashcan used by popular Linux desktop environments such as KDE, GNOME, and XFCE which can be invoked from the command line (and via scripts).

Trash-cli provides these commands:

$ trash-put           #trash files and directories.
$ trash-empty         #empty the trashcan(s).
$ trash-list          #list trashed files.
$ trash-restore       #restore a trashed file.
$ trash-rm            #remove individual files from the trashcan.

In this article, we will show you how to install and use trash-cli to find the original path, deletion date, and permissions of deleted files in Linux.

How to Install Trash-cli in Linux

The straightforward way of installing trash-cli is by using easy_install tool as follows:

$ sudo apt-get install python-setuptools		#Debian/Ubuntu systems
$ sudo yum install python-setuptools			#RHEL/CentOS systems
$ sudo easy_install trash-cli	

Else, install Trash-cli from source as shown.

$ git clone https://github.com/andreafrancia/trash-cli.git
$ cd trash-cli
$ sudo python setup.py install

How to Use Trash-cli in Linux

To trash a specific file, run.

$ trash-put file1

List all trashed files.

$ trash-list

2017-05-05 10:30:48 /home/tecmint/file1
2017-05-10 13:40:41 /home/tecmint/file2
2017-05-12 22:30:49 /home/tecmint/file3
2017-05-12 22:50:48 /home/tecmint/test

Search for a file in the trashcan.

$ trash-list | grep file

2017-05-05 10:30:48 /home/tecmint/file1
2017-05-10 13:40:41 /home/tecmint/file2
2017-05-12 22:30:49 /home/tecmint/file3

Restore a trashed file.

$ trash-restore

0 2017-05-05 10:30:48 /home/tecmint/file1
1 2017-05-10 13:40:41 /home/tecmint/file2
2 2017-05-12 22:30:49 /home/tecmint/file3
3 2017-05-12 22:50:48 /home/tecmint/test

Remove all files from the trashcan.

$ trash-empty

Remove only the files that have been deleted more than <days> ago:

$ trash-empty <days>

Here is a demonstration of this command:

$ date
Mon May 15 20:26:52 EAT 2017
$ trash-list
2017-05-12 13:51:12 /home/tecmint/new.txt
2017-05-11 10:41:30 /home/tecmint/old.txt
2017-04-05 20:43:54 /home/tecmint/oldest.txt
$ trash-empty  7
$ trash-list
2017-05-12 13:51:12 /home/tecmint/new.txt
2017-05-11 10:41:30 /home/tecmint/old.txt
$ trash-empty 1
$ trash-list
2017-05-12 13:51:12 /home/tecmint/new.txt

Remove only files matching a pattern.

Do not forget to use quotes in order to protect the pattern from shell expansion:

$ trash-rm  /*.txt

For more information, check out Trash-cli Github repository: https://github.com/andreafrancia/trash-cli

That’s all! Do you know of any similar CLI tools for Linux? Share some info about them with us via the comment form below.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
Previous Post

Ntfy – Get Desktop or Phone Alerts When Long Running Command Finishes

Next Post

How To Set Up And Use Fastcgi Environment In (IIS) 7, IIS 7

Next Post
How To Set Up And Use Fastcgi Environment In (IIS) 7, IIS 7

How To Set Up And Use Fastcgi Environment In (IIS) 7, IIS 7

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet