[How To] Empty Trash in Ubuntu from command line

Share with all..

Ubuntu is one of the widely used desktop operating system in the open source world. Like Recycle Bin in Windows, Ubuntu has Trash to store the deleted files and retrieve them anytime.

Sometimes, deleting all the contents from Trash may take a longer time or it may hang up your system. In this case, deleting single file will be a tedious job. Instead of using GUI, all the contents in the Trash directory can be deleted in one shot from command line/shell/terminal.

Below are the steps to delete all the contents from Trash using command line/shell/terminal:

1) Open terminal and navigate to your home directory, typically /home/username.

2) Go to the Trash directory present at .local/share/Trash

cd .local/share/Trash/

The complete Trash directory path is $HOME/.local/share/Trash

3) From the list of folders, go the folder with name as files.

cd files

The above folder contains all of your Trash files.

4) Delete all the files using following command:

rm -rf *

Be patient, since it may take sometime to delete the files depending upon Trash size.

Note: This method will delete Trash contents only of the specific user. To delete Trash of another user, login with that user and repeat the procedure.

Share with all..

About Abhijit Sandhan

Loves Open Source, Blogging, Traveling, Hiking and sharing Knowledge!

One comment

  1. Hey! This is really all nice and informational but if you are looking for a cool no-brainer way to take care of trash files in Ubuntu , then just install the "autothrash" package. It has all you need and it doesn't require you to remember complex command line arguments or obscure folder paths.


    autotrash -- program to automatically purge old files from the
    FreeDesktop.org trash


    autotrash [-d purge_n_days_old]

    autotrash [--delete number_of_megabytes_to_purge]

    autotrash [--keep-free number_of_megabytes_to_free]


    See man page:

Leave a Reply

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