Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am not able to search trash anywhere. Can you please tell me a command or anything like that to empty the trash using terminal ?

share|improve this question
up vote 147 down vote accepted

You can use this command :

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

The rm command removes (delete) files or directories.

-f, --force     Ignore nonexistant files, and never prompt before removing.
-r, -R, --recursive     Remove directories and their contents recursively.

The trash folder is found at: $HOME/.local/share/Trash

Be careful how to use rm command because any misuse may cause deleting sensitive system folders and files .

share|improve this answer
~ always means /home/currentuser? I mean it is fixed? – hellodear May 18 '14 at 16:00
This wont work if the trash is somewhere else. – Braiam May 18 '14 at 17:56
@hellodear2 Notice that ~ is only a shell-specific thing, which expands to your home directory path. Using, e.g. "~/some/path" won't expand because of quoting. Likewise, not all file managers will understand ~ if you enter it in address bar. – Ruslan May 19 '14 at 10:05
Sensitive system folders and files cannot be removed without privileges, and rm cannot remove folders at all, unless you give it the -r (or equivalent) option. However using rm without proper care may case loss of lost of important personal files, especially if used with wildcard arguments. – Marc van Leeuwen May 19 '14 at 19:06
@hellodear2 see this and this questions for examples when tilde doesn't appear to work (these are about bash though). I don't really know what specific shells don't support it, but you should understand that tilde is implemented not on file system level, but on the level of application. XFE is an example of file manager which doesn't understand ~ in address bar. – Ruslan May 20 '14 at 20:27

With trash-cli installed, you can do


more interesting details about trash handling: Here

share|improve this answer
That won't work out of the box though, and requires the installation of trash-cli. – skarz May 18 '14 at 17:27
Yes, but it's the correct answer. If you have an USB stick in, for example, the files you trash in it will be put in an hidden directory in the root of the device (at least it happened last time I checked) .Trash-$UID - so in this case the trash is physically in two different places... – Rmano May 19 '14 at 5:10
trash-cli works great. A similar tool that you may wish to try is autotrash: – gerlos Oct 9 '14 at 9:47
@Michael "Trash" is a feature provided by the desktop manager, which is a layer above the stuff that you would usually use in the command line. Really all it does is move files into a hidden folder on the same device, and store some metadata so they can be put back into place if the user would like. You don't actually reclaim any space until you "empty" the trash, which is when the file is actually deleted. – Seamus Aug 24 '15 at 20:50
It should be noted that this command is user specific. I installed it and was scratching my head about why it wasn't working til I realized the files were in the trash of another user. – billynoah Dec 29 '15 at 2:54

You are looking for the $XDG_DATA_HOME/Trash directory. The trash directory is defined in the "Desktop Trash Can Specification" of the freedesktop site. This variable is normally not available in the terminal windows, hence you will need for trash-empty. This command follows all the specification of the and it's intelligent enough to find out where the Trash is. You will need to install it first.

There are other tools for this, like gvfs-trash --empty which can also send items to the Trash can.

share|improve this answer
+1 for $XDG_DATA_HOME. How did you get that? – i08in May 18 '14 at 18:08
@Jobin is all in the specification. – Braiam May 18 '14 at 18:10
@Braiam Can you please elaborate more? How can I use it? I am not getting how it is solving my purpose. Please explain a little bit. And I don't want to trash the items, I want to empty the trash. – hellodear May 20 '14 at 16:54
@hellodear2 trash-empty empties the trash. You only need to run it. The binary is in the trash-cli package. Is the same as jhort solution just that I explain where it comes from and offer another tool. – Braiam May 20 '14 at 18:07

With trash-cli installed type trash-empty

to install trash-cli type sudo apt-get install trash-cli

share|improve this answer
Note: sudo is not required. neither is duplicating a previous answer. – Elder Geek Mar 31 '15 at 3:23
for clarification on the comment by @ElderGeek: sudo is indeed needed to install trash-cli, but is not needed to invoke trash-empty. (comment was valid for the original answer, but is confusing since the answer was edited) – Corey Goldberg Jan 30 at 14:02

I had problems with

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

So I had to change directory as

cd ~/.local/share/Trash/

Then do

sudo -s


sudo rm -fr *

And then everything was gone..

share|improve this answer

protected by heemayl Aug 3 '15 at 19:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.