Ubuntu Empty Trash

Deleted files in Ubuntu are normally moved to the trash. This is nothing unusual, but what’s different compared to most platforms is that the trash isn’t automatically cleared after a set time. 

This feature (30 days) is toggled off by default, meaning you can accumulate a lot of trash after a while. So, it’s important to either turn on auto-deletion or manually empty the trash as we’ve shown in this article.

Empty Trash Graphically

Although there are multiple ways to empty the trash via the GUI, only the steps are different. The end result is the same regardless of how you do it.

  • You can right-click the Trash icon from the dock and select Empty trash.
    ubuntu dock empty trash
  • You can right-click Trash from the file explorer and select Empty trash.
    nautilus empty trash
  • You can select specific items to delete while inside the Trash directory. Or, you can click on Empty to delete all items.
    delete from trash ubuntu
  • You can open Trash Settings and empty the trash from there. Additionally, you can also delete temp files, turn on auto-deletion, or set the time period.
    file history and trash

Empty Trash via Terminal

Occasionally, due to permission issues and the like, you won’t be able to graphically delete some items from the trash. In such cases, you can use the rm command.

On recent Ubuntu versions, the Trash directory can be found at ~/.local/share/Trash.

This path may differ on older versions, so adjust it as appropriate. And as we’re using rm with root privileges, make sure to double-check the file paths as it’s very easy to delete the wrong file or directory.

Now, to delete a specific file from the trash, use rm like so

sudo rm ~/.local/share/Trash/files/sampleimage.png

If you want to empty everything from the trash, use the following command instead. We’re using the r and f options to recursively delete files and ignore any errors or warnings.

sudo rm -rf ~/.local/share/Trash/*
Anup Thapa

Senior Writer

Anup Thapa is a Linux enthusiast with an extensive background in computer hardware and networking. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys reading up on a range of topics, traveling, working out, and MOBAs.