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
- 1,076
rm -rf ~/.local/share/Trash/files
If not under .local/share, it may be under ~/.Trash
- 28,240
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