What is the shell command to empty the garbage bin under Linux?
4 Answers
Except for the ~/.local/share/Trash trash files for other file systems may be stored in <mount-point>/.Trash-$(id -u) directories.
If your're running ubuntu there is a helper package to clean all locations
sudo aptitude install trash-cli
To clean the trash in all locations just run:
empty-trash
It should work with any linux desktop environment compliant with FreeDesktop.org Trash Specification. On newer versions, the command may be:
trash-empty
- 105
- 5
- 1,056
- 5
- 10
-
Good point. More info here: http://manpages.ubuntu.com/manpages/lucid/man1/empty-trash.1.html – Linker3000 Oct 15 '10 at 09:50
rm -rf ~/.local/share/Trash/files
If not under .local/share, it may be under ~/.Trash
- 27,498
- 3
- 52
- 73
-
Thanks for your answer, but in .local/share/ I have just "applications" and "mime", no Trash to be found :(. – Rob Oct 15 '10 at 09:35
-
After installing the OS if you haven't deleted/moved anything to Trash from GUI, then the Trash folder under user's directory wont get created at all. So if you search for Trash directory from command line you wont find. Now lets say you move/delete a file into Trash from GUI, that's when the directory Trash gets created and is accessible from command-line. If you restore the file or delete the file permanently either from GUI or from command line the Trash folder still stays and is accessible from GUI and command-line.
command line Trash directory:- "/root/.local/share/Trash" under Trash you got two directories again, one with "files" and one with "info". files :- actual data info :- metadata of the data
Checked this on Centos 6.8
Edit :- the files in the thrash can be either deleted from GUI or by getting into /root/.local/share/Trash/files and remove everything
- 101
- 3
-
As written, this is useful supplementary information, but doesn't directly answer the question of what is the command. Can you run this answer to the finish line? – fixer1234 Nov 12 '16 at 19:41