How to forcefully empty the Trash : Ubuntu (5.10 / 6.06.1 / 6.10)
Have you ever run into the situation where something wouldn’t delete from your Trash folder? I’ve run into it a few times and I’m not even sure why it happens. For those times when you need to forcefully empty the Trash you can use the following command:
rm -rf $HOME/.Trash or sudo rm -rf $HOME/.Trash
Note: you should be careful when using the -f (forceful) option with remove. It will just straight-out remove something with no verification. It could be dangerous if it ever fell into the wrong hands
.
Yes, this is a quick tutorial for the day. Tune in tomorrow for a little talk about Viruses.
Categories: Linux
Before you do it next time, check the permissions and ownership of the things in your trash. My guess is that they don’t belong to you. chown + chmod them and see if you can empty the trash without using an “rm -rf”. Anyway, that usually helps me.
I’d recommend not to remove the trash can itself. Use
rm -rf $HOME/.Trash/*
instead when emptying the trash can this way.
I wonder if this happens when you delete a read-only directory.
I’m certain that it is harmless to remove the ~/.Trash directory itself. I’m sure GNOME will re-create it on demand.
By the way, not everything in your trash can is stored in ~/.Trash/. If you’ve deleted something on other partitions, the trash will be stored in the root of that particular partition, under .Trash-yourusername.
you really helped me!!!!!
… other partitions….
ThanksThanksThanksThanksThanksThanks
Fiorenzo
My guess is that, yes, its caused by read-only files. It hasn’t happened often but I’ve had to forcefully remove items even after checking ownership & permissions.
thanks for the comments. Alexander’s method is probably safest in my opinion.
My Trash directory is somewhere else. But generally thank you!
This is my path:
/home/zager/.local/share/Trash/files
Where “zager” is my login name.
This worked!
sudo rm -rf /home/username/.local/share/Trash/files
Thanks a lot, Vitezslav Valka
from the detailed path:
/home/username/.local/share/Trash/files
in your post I was able to delete files & folder from Trash in Ubuntu Intrepid 8.10
That FINALLY worked, thanks tons! [even though that post is almost a year old, haha]