How to Completely Erase the Ubuntu ‘Trash Can’ via Terminal (Force Empty)

When you delete a file in the Ubuntu graphical desktop environment, it isn’t actually deleted from your hard drive. It is simply moved to a hidden folder named .Trash-1000, allowing you to easily recover it later. Usually, right-clicking the Trash icon in your dock and selecting “Empty Trash” is sufficient to permanently delete these files.

However, if you moved a file to the trash that was owned by the root user, or if you deleted a corrupted directory containing millions of tiny files, the graphical “Empty Trash” command will simply freeze or throw a “Permission Denied” error. The trash can becomes permanently stuck, refusing to empty. To fix this, you must use the terminal to bypass the graphical interface and forcefully obliterate the contents of the hidden trash directory.

How to Completely Erase the Ubuntu Trash Can via Terminal

You must use the absolute remove command (rm -rf) on the specific hidden directory.

  1. Open your Terminal application (Ctrl + Alt + T).
  2. To forcefully delete everything inside your personal user’s trash folder, carefully copy and paste the following exact command: rm -rf ~/.local/share/Trash/files/*
  3. Press Enter. This deletes the physical files.
  4. Next, you must delete the metadata files (which tell the trash icon whether it looks full or empty). Type this command and press Enter: rm -rf ~/.local/share/Trash/info/*

If the terminal returns a “Permission Denied” error on either of those commands, it means the stuck files are owned by the root administrator. You must elevate your privileges using sudo. Type the following commands, pressing Enter after each one and providing your password when prompted:

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

The terminal will silently and forcefully delete every single file within milliseconds, regardless of file permissions or corruption. Look at your Ubuntu dock; the Trash icon will now display as completely empty.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.