Thursday, August 31, 2017

Trash cli Manage Trash from Command line in Ubuntu Linux

Trash cli Manage Trash from Command line in Ubuntu Linux



By using a utility named trash-cli you can simply mange Trash from command line  

 The location of Trash folder in old GNOME version is (~/.Trash), in current versions it is in ~/.local/share/Trash. There is two sub folders named files and info. The files folder contains the files deleted and info directory consists of meta data for each deleted file.



First step, install trash-cli utility

$ sudo apt-get install trash-cli

It installs three commands,
1. list-trash to list down the files in trash
2. trash to move the file to trash
3. restore-trash to restore the file to original path

Usage:

$ trash love.txt      ( move the file love.txt to trash folder)

$ list-trash              (List the contents of Trash folder) 

       2011-10-27 22:46:28 /home/abc/love.txt



 $ restore-trash love.txt   (Restore the file love.txt) 

   0 2011-10-27 22:46:28 /home/abc/love.txt
What file to restore [0..0]: 0  (if there is more than one file list shows 1  2  3 etc)

download file now