Empty Ubuntu Gnome Trash from the Command Line

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/*

You may also like...

67 Responses

  1. James says:

    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.

  2. heretic says:

    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!

  3. jake says:

    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

  4. Izkata says:

    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

  5. baga says:

    thx a lot this really helpful

  6. Thierry B. says:

    Using Andrea Francia trash-cli package is very helpful :

    sudo empty-trash empty your trash with any permission problem whereas

    sudo su

    empties **root** trash !

  7. Arup Roy Chowdhury says:


    Thank you very much, best advice given, it works like a charm.

  8. Pisu says:

    Confirm that Trash is at: ~/.local/share/Trash/files/ in Ubuntu 8.10.

  9. Lopo says:

    Instead of using sudo rm -rf ~/.local/share/Trash/files/* use the full path if you still have issues.

    user@machine:~$ sudo rm -rf /home//.local/share/Trash/files/*

    Replace by your own username, of course.

  10. Lopo says:

    Oops! <user> was removed from the command.


    user@machine:~$ sudo rm -rf /home/<user>/.local/share/Trash/files/*

  11. Chaitanya says:

    sudo rm -rf ~/.local/share/Trash/files/*

    Thanks! This helped me remove a file that the trash can wouldn’t delete for some reason!

  12. Sam says:

    Can’t remove anything. It always says read only file system, so now i’ve got no place on my hardrive…

  13. Phydoux says:

    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.

  14. zwagery says:

    matur nuwun, helped me remove a file that the trash can wouldn’t delete for some reason!
    sudo rm -rf ~/.local/share/Trash/files/*

  15. Lex Ross says:

    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.

  16. Jim E. says:

    Thanks Lex. Nothing else worked for me either except for removing the Trash applet and then adding it back to the panel.

  17. coderoid says:

    @jake you’re a hero! thanks guys..

  18. Shai says:

    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

  19. Chris says:

    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.

  20. Joe says:

    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.

  21. Keith says:

    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…..

  22. slacker400 says:

    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

    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!

  23. Keith says:

    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? 🙂

  24. 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


    Then I deleted the as follows

    # rm -rf /data-l1/.Trash-1000/files/*
    # rm -rf /data-l1/.Trash-1000/info/*

    This emptied my Trash
    Good luck

  25. Buzz says:

    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/*’

  26. ExoDaz says:

    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.

  27. Amar says:

    Trash shows as having items inside .. “2 items in Trash”
    And it’s not getting emptied. Tried all the methods.

  28. LadySol says:

    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!

  29. Eddie says:

    Thank you LadySol! I din’t think about nesting the command in su mode. Nothing else worked…well didn’t try trash-cli.

  30. ishan says:

    sudo rm -rf ~/.local/share/Trash/files/*

    this worked for me!!


Leave a Reply

Your email address will not be published. Required fields are marked *