Empty Ubuntu Gnome Trash from the Command Line Posted on December 27, 2006 by ruchi 67 Comments Sponsored Link Ubuntu has a trash can/recycle bin feature similar to windows. The difference with Ubuntu is that you can empty the trash from the command line. First you need to open your terminal and type the following command rm -rf ~/.Trash/* Related posts Working with Songbird and wma files (3) Workaround for Feisty screensaver bug (6) Windows NTFS Partitions Read/write support made easy in Ubuntu Feisty (47) Winamp Presets for your XMMS Music Player (16) Widescreen Resolutions for Intel Display Cards In Ubuntu Feisty (5) What to Expect from Ubuntu 8.04 (Hardy Heron) (29) What package is that file in ? (1) 67 thoughts on “Empty Ubuntu Gnome Trash from the Command Line” « Older Comments Newer Comments » Thanks a lot ayenack! I am using 8.04 hardy heron and the command: sudo rm -rf ~/.local/share/Trash/files/* worked like a charm! A word of recommendation to those who can’t get it working. Simply copy and paste. Yeah, it’s a lazy thing to do, but if typing it ain’t cutting it, then it’s an operator error, not a computer error. Keep that in mind when it seems the command line isn’t cooperating. I too had problems deleting files that I had copied from a data cd. some times was able to change permissions till this last lot of trash on my 8.04v. command worked! my first success at command line! great for the confidence. tis a wonderful website! bad a$$ i had like 200 mp3s that i couldnt get rid of sudo rm -rf ~/.local/share/Trash/files/* that worked on ubuntu 2.0 thanks Emil: “Such a simple thing poses problems to so many people! Conclusion: stupid users? NO. It’s a usability thing. It is much better to have it Windows style in this case: a visual thing, right-click + empty.” Guess what Emil? IT DOES EXIST. Take a look at the lower-right hand corner of the screen – that’s where the Trash icon is by default. Left clicking opens it, and you can either right-click and choose empty trash, or hit the “Empty Trash” button while viewing the files. We just find the terminal faster, generally. Oh, and as for my problem earlier, I now know what was wrong – link makes hardlinks only, while nautilus makes softlinks. Here’s the command you need: ln -s .local/share/Trash/ .Trash thx a lot this really helpful Using Andrea Francia trash-cli package is very helpful : sudo empty-trash empty your trash with any permission problem whereas sudo su empty-trash empties **root** trash ! Thierry, Thank you very much, best advice given, it works like a charm. Confirm that Trash is at: ~/.local/share/Trash/files/ in Ubuntu 8.10. Instead of using sudo rm -rf ~/.local/share/Trash/files/* use the full path if you still have issues. [email protected]:~$ sudo rm -rf /home//.local/share/Trash/files/* Replace by your own username, of course. Oops! <user> was removed from the command. It’s: [email protected]:~$ sudo rm -rf /home/<user>/.local/share/Trash/files/* sudo rm -rf ~/.local/share/Trash/files/* Thanks! This helped me remove a file that the trash can wouldn’t delete for some reason! Can’t remove anything. It always says read only file system, so now i’ve got no place on my hardrive… All I did was restored the folder and reset the permissions and then I was able to empty my trash can after I deleted the folder again. matur nuwun, helped me remove a file that the trash can wouldn’t delete for some reason! sudo rm -rf ~/.local/share/Trash/files/* Last time I have emptied my trash the trash applet said it was 4 elements left in the trash. Nautilus showed the trash as empty, and also there was nothing left in ~/.local/share/Trash/files and info directories. Removing trash applet and then putiing it back onto the taskbar fixed the problem. Weird. This is on Intrepid 8.10 with Gnome 2.24.1 Hope this helps. Cannot file a bug report since I don´t know how to reproduce. Thanks Lex. Nothing else worked for me either except for removing the Trash applet and then adding it back to the panel. @jake you’re a hero! thanks guys.. The following works on Ubuntu Hardy Heron 8.04 1. open terminal 2. type gksudo dbus-launch nautilus 3. hit enter 4. navigate to /home/USERNAME/.local/share/Trash/files 5. Delete whatever you want Good to know this. Here’s the problem it solves (partially) for me: I deleted files from my desktop. Unfortunately the permissions of the folders/files was read only. Trash would not allow me to delete them permanently or change permissions. Copying back to the desktop and changing permissions wouldn’t work because that would still leave copies in Trash that couldn’t be manipulated. sudo rm -rf ~/.local/share/Trash/files/* deleted most of them. It left one folder – not sure why; i’ll have to look into it later. Thanks. It could be that the troublesome item stuck in the Trash is not in your home directory, but on another hard disk or partition. In that case, use the command line to delete them after changing to that directory. For example: # cd /media/ExternalDisk/.Trash-1000/files # rm -rf * Be very careful you are in that Trash directory before using the powerful delete command as Root. I had a similar problem… tried emptying the trash with the icon and it would say emptying and you could see the progress, but when you went in the folder everything was still there. Tried all the commands and same thing. The only way i got it to work was to cntl-alt F6 and log into another session on the command line and physically go to the folder and delete stuff using the rm -rf commmand…. very strange. After i did that, when i went back to my xwindows session i was able to empty the trash as normal again….. I had this issue where I had been deleting files using the root authority on 9.04. When emptying the trash I would get an error that not all files can be displayed but the mouse pointer would spin for minutes and nothing would be displayed. Thierry B.’s sugguestion worked for me. apt-get install trash-cli empty-trash Funny thing is I do a lot of VM work on this box, and it’s been a while since I really looked at my disk utilization. this utility cleared the 20 GB of files I knew about and it cleared another 30 GB of stuff I didn’t know was still on the drives. THIS IS WHY LINUX Fails to penetrate the windows desktop world. We can’t even have a fully functional trash bin on the Desktop? SIGH. I’ll keep believing! I love linux and these little quirks are nothing to me…. so many positives compared to the negatives of windows…. Do I have to list them? 🙂 This is how I managed to delete the troublesome folder. In the terminal I typed # locate brid the following two lines where amongst the output /data-l1/.Trash-1000/files/brid /data-l1/.Trash-1000/info/brid.trashinfo Then I deleted the as follows # rm -rf /data-l1/.Trash-1000/files/* and # rm -rf /data-l1/.Trash-1000/info/* This emptied my Trash Good luck Folks, you need to delete the ~/.local/share/Trash/info/* files too. I aliased it: alias emptytrash=’rm -fr ~/.local/share/Trash/files/* ~/.local/share/Trash/info/*’ I find this really useful when working without X running. Basically, enter the following alias into your .bashrc file; alias ebin=’rm -rf ~/.local/share/Trash/files/*’ Replace ebin with whatever command you want to use to carry out the operation and all you have to do is issue that command whenever you want to empty the trash. Trash shows as having items inside .. “2 items in Trash” And it’s not getting emptied. Tried all the methods. I wasn’t able to delete the plethora of files that had accumulated in my root trash until I used sudo su, first and then ran sudo rm -rf ~/.local/share/Trash/files/* Thanks for this forum discussion, I had no idea how to get rid of the files before. Yeah, free space! Thank you LadySol! I din’t think about nesting the command in su mode. Nothing else worked…well didn’t try trash-cli. sudo rm -rf ~/.local/share/Trash/files/* this worked for me!! thnx « Older Comments Newer Comments » Leave a comment Cancel reply Your email address will not be published. Required fields are marked *Comment Name * Email * Website Save my name, email, and website in this browser for the next time I comment.