Trash in GNOME is generally handled in Nautilus file browser. Trash icon’s context menu provides shortcut to empty trash. But while working in command line, you may not prefer to empty trash by going to Trash icon in panel or file browser.
In older version of GNOME, the trash folder is in .Trash folder in your home directory (~/.Trash). But in current version (2.30) it is ~/.local/share/Trash/. It has two sub folders called files and info. The files folder contains the files deleted and info directory consists of meta data for each deleted file.
Here is an example:
$ cat ~/.local/share/Trash/info/style.org.css.trashinfo[Trash Info]Path=/home/blackgod/Desktop/style.org.cssDeletionDate=2010-06-01T09:59:18
How to empty trash is straight forward now. Just delete the content of Trash folder – Check the below command snippet for more clarification.
$ rm -rf ~/.local/share/Trash/*
Warning: Be careful while using rm -rf command, so as not to delete other files.
Using trash-cli tool:
Install trash-cli tool, which manages the trash in command line which is equivalent to Trash functionalites in Nautilus fire browser. It acts upon the Trash directory we have mentioned above.
It can be installed with,
$ 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
The below console session is an example of its capability.
$ trash voice-message.wav
2010-06-07 23:20:41 /home/blackgod/Downloads/voice-message.wav
$ trash ubuntu-10.04-desktop-i386.iso.torrent$ restore-trash voice-message.wav0 2010-06-07 23:22:21 /home/blackgod/Downloads/ubuntu-10.04-desktop-i386.iso.torrent1 2010-06-07 23:20:41 /home/blackgod/Downloads/voice-message.wavWhat file to restore [0..1]: 1
$ list-trash2010-06-07 23:22:21 /home/blackgod/Downloads/ubuntu-10.04-desktop-i386.iso.torrent
I believe this post won’t go to trash, may be useful to some one