Monday, July 24, 2017

How to delete trash from command line

How to delete trash from command line

When you delete files or folder on lubuntu normally it will goes to trash can first, and then you can permanently delete if you wish, but sometimes it doesn't work, there are some files that can't be removed on the trash can. The solution is to delete from command line.

If you delete files or folders that under root privilege, it goes to trash can, but on you won't be able to clear the trash can, empty trash won't work. The only way you can delete these files is from command line.

First of all you need to know the location of trash can, it is under hidden folder .local, here's the complete path:
You can cd to that path and see all the files and folder inside your trash can.
cd ~/.local/share/Trash/files
ls -l
Now you can delete all files and folder inside trash, with this simple command:
sudo rm -r *
Or this:
sudo rm -r ~/.local/share/Trash/files/*


  1. I almost skip the trash can all together. Selecting whatever I want to get rid of in the GUI, I press [Shift]+[Delete] and then say "OK" to permanently delete.

    1. you can do that with normal files, but if you have files under root permission it won't work