How can I empty the trash using terminal?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
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 ?
command-line trash
add a comment |
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 ?
command-line trash
2
This was posted 3 years ago. We need something that spells this out including what version it works for here in 2017
– SDsolar
Jul 29 '17 at 6:53
add a comment |
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 ?
command-line trash
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 ?
command-line trash
command-line trash
edited May 24 '14 at 15:16
Seth♦
35.3k27112166
35.3k27112166
asked May 18 '14 at 15:39
hellodearhellodear
1,66831321
1,66831321
2
This was posted 3 years ago. We need something that spells this out including what version it works for here in 2017
– SDsolar
Jul 29 '17 at 6:53
add a comment |
2
This was posted 3 years ago. We need something that spells this out including what version it works for here in 2017
– SDsolar
Jul 29 '17 at 6:53
2
2
This was posted 3 years ago. We need something that spells this out including what version it works for here in 2017
– SDsolar
Jul 29 '17 at 6:53
This was posted 3 years ago. We need something that spells this out including what version it works for here in 2017
– SDsolar
Jul 29 '17 at 6:53
add a comment |
5 Answers
5
active
oldest
votes
You can use the ˋrmˋ command:
rm -rf ~/.local/share/Trash/*
The rm command removes (deletes) 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 you use the rm
command - the files aren't sent to a trash can where you can undelete them, so it's not easy to undo.
10
This wont work if the trash is somewhere else.
– Braiam
May 18 '14 at 17:56
1
@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
11
Sensitive system folders and files cannot be removed without privileges, andrm
cannot remove folders at all, unless you give it the-r
(or equivalent) option. However usingrm
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
1
@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
4
why is this seemingly approx. 100 times faster than clicking trash "empty" in any file browser?
– Blauhirn
Nov 24 '16 at 13:13
|
show 5 more comments
With trash-cli
installed, you can do
trash-empty
more interesting details about trash handling: Here
6
That won't work out of the box though, and requires the installation of trash-cli.
– skarz
May 18 '14 at 17:27
19
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
So sad that you have to install a package just to empty the trash. Counting the trash against the disk space is one of the most annoying features of Ubuntu.
– Michael
May 15 '15 at 21:48
3
@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 Connor
Aug 24 '15 at 20:50
3
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
|
show 2 more comments
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 Freedesktop.org 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.
+1 for$XDG_DATA_HOME
. How did you get that?
– jobin
May 18 '14 at 18:08
4
@Jobin is all in the specification. ramendik.ru/docs/trashspec.html
– 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
2
@hellodear2trash-empty
empties the trash. You only need to run it. The binary is in thetrash-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
Nowgio trash --empty
, at least on Ubuntu 18.10/Gnome 3.
– J. B. Rainsberger
Feb 14 at 14:30
add a comment |
With trash-cli installed type trash-empty
to install trash-cli type
sudo apt-get install trash-cli
This looks safer
– Nabil Kadimi
Jul 31 '17 at 11:30
add a comment |
I had problems with
rm -rf ~/.local/share/Trash/*
So I had to do:
sudo -s
cd ~/.local/share/Trash/
Before typing the next command, make absolutely sure you are in the correct directory, because you can easily delete everything in your home folder this way and there will be no warning.
rm -fr *
And then everything was gone...
Why sudo, and why rm -rf. It's unnecessary.
– mikewhatever
Jul 29 '17 at 8:15
1
@mikewhatever - Whysudo
? Because I had deleted something as a superuser, and so to empty theTrash
, I had to dosudo
to have that privilege. Simplysudo rm -rf /fullabsolutepath
works in one command.
– Harvey
Nov 10 '17 at 23:10
trash-empty and rm -rf ~/.local/share/Trash/* don't work if you delete from root folders. @Cisum's answer worked best for me.
– rainer
Apr 1 '18 at 15:26
wtf is that? I tried this and everything was gone. All data gone from my system.
– Rajneesh071
May 4 '18 at 7:54
How to revert it back?
– Rajneesh071
May 4 '18 at 7:54
add a comment |
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?
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the ˋrmˋ command:
rm -rf ~/.local/share/Trash/*
The rm command removes (deletes) 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 you use the rm
command - the files aren't sent to a trash can where you can undelete them, so it's not easy to undo.
10
This wont work if the trash is somewhere else.
– Braiam
May 18 '14 at 17:56
1
@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
11
Sensitive system folders and files cannot be removed without privileges, andrm
cannot remove folders at all, unless you give it the-r
(or equivalent) option. However usingrm
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
1
@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
4
why is this seemingly approx. 100 times faster than clicking trash "empty" in any file browser?
– Blauhirn
Nov 24 '16 at 13:13
|
show 5 more comments
You can use the ˋrmˋ command:
rm -rf ~/.local/share/Trash/*
The rm command removes (deletes) 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 you use the rm
command - the files aren't sent to a trash can where you can undelete them, so it's not easy to undo.
10
This wont work if the trash is somewhere else.
– Braiam
May 18 '14 at 17:56
1
@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
11
Sensitive system folders and files cannot be removed without privileges, andrm
cannot remove folders at all, unless you give it the-r
(or equivalent) option. However usingrm
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
1
@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
4
why is this seemingly approx. 100 times faster than clicking trash "empty" in any file browser?
– Blauhirn
Nov 24 '16 at 13:13
|
show 5 more comments
You can use the ˋrmˋ command:
rm -rf ~/.local/share/Trash/*
The rm command removes (deletes) 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 you use the rm
command - the files aren't sent to a trash can where you can undelete them, so it's not easy to undo.
You can use the ˋrmˋ command:
rm -rf ~/.local/share/Trash/*
The rm command removes (deletes) 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 you use the rm
command - the files aren't sent to a trash can where you can undelete them, so it's not easy to undo.
edited Sep 21 '17 at 3:38
Zanna
51.3k13140243
51.3k13140243
answered May 18 '14 at 15:41
nuxnux
23.2k3096117
23.2k3096117
10
This wont work if the trash is somewhere else.
– Braiam
May 18 '14 at 17:56
1
@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
11
Sensitive system folders and files cannot be removed without privileges, andrm
cannot remove folders at all, unless you give it the-r
(or equivalent) option. However usingrm
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
1
@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
4
why is this seemingly approx. 100 times faster than clicking trash "empty" in any file browser?
– Blauhirn
Nov 24 '16 at 13:13
|
show 5 more comments
10
This wont work if the trash is somewhere else.
– Braiam
May 18 '14 at 17:56
1
@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
11
Sensitive system folders and files cannot be removed without privileges, andrm
cannot remove folders at all, unless you give it the-r
(or equivalent) option. However usingrm
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
1
@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
4
why is this seemingly approx. 100 times faster than clicking trash "empty" in any file browser?
– Blauhirn
Nov 24 '16 at 13:13
10
10
This wont work if the trash is somewhere else.
– Braiam
May 18 '14 at 17:56
This wont work if the trash is somewhere else.
– Braiam
May 18 '14 at 17:56
1
1
@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
@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
11
11
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
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
1
1
@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
@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
4
4
why is this seemingly approx. 100 times faster than clicking trash "empty" in any file browser?
– Blauhirn
Nov 24 '16 at 13:13
why is this seemingly approx. 100 times faster than clicking trash "empty" in any file browser?
– Blauhirn
Nov 24 '16 at 13:13
|
show 5 more comments
With trash-cli
installed, you can do
trash-empty
more interesting details about trash handling: Here
6
That won't work out of the box though, and requires the installation of trash-cli.
– skarz
May 18 '14 at 17:27
19
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
So sad that you have to install a package just to empty the trash. Counting the trash against the disk space is one of the most annoying features of Ubuntu.
– Michael
May 15 '15 at 21:48
3
@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 Connor
Aug 24 '15 at 20:50
3
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
|
show 2 more comments
With trash-cli
installed, you can do
trash-empty
more interesting details about trash handling: Here
6
That won't work out of the box though, and requires the installation of trash-cli.
– skarz
May 18 '14 at 17:27
19
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
So sad that you have to install a package just to empty the trash. Counting the trash against the disk space is one of the most annoying features of Ubuntu.
– Michael
May 15 '15 at 21:48
3
@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 Connor
Aug 24 '15 at 20:50
3
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
|
show 2 more comments
With trash-cli
installed, you can do
trash-empty
more interesting details about trash handling: Here
With trash-cli
installed, you can do
trash-empty
more interesting details about trash handling: Here
edited May 19 '14 at 11:59
nux
23.2k3096117
23.2k3096117
answered May 18 '14 at 16:36
jhortjhort
1,277157
1,277157
6
That won't work out of the box though, and requires the installation of trash-cli.
– skarz
May 18 '14 at 17:27
19
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
So sad that you have to install a package just to empty the trash. Counting the trash against the disk space is one of the most annoying features of Ubuntu.
– Michael
May 15 '15 at 21:48
3
@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 Connor
Aug 24 '15 at 20:50
3
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
|
show 2 more comments
6
That won't work out of the box though, and requires the installation of trash-cli.
– skarz
May 18 '14 at 17:27
19
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
So sad that you have to install a package just to empty the trash. Counting the trash against the disk space is one of the most annoying features of Ubuntu.
– Michael
May 15 '15 at 21:48
3
@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 Connor
Aug 24 '15 at 20:50
3
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
6
6
That won't work out of the box though, and requires the installation of trash-cli.
– skarz
May 18 '14 at 17:27
That won't work out of the box though, and requires the installation of trash-cli.
– skarz
May 18 '14 at 17:27
19
19
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
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
So sad that you have to install a package just to empty the trash. Counting the trash against the disk space is one of the most annoying features of Ubuntu.
– Michael
May 15 '15 at 21:48
So sad that you have to install a package just to empty the trash. Counting the trash against the disk space is one of the most annoying features of Ubuntu.
– Michael
May 15 '15 at 21:48
3
3
@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 Connor
Aug 24 '15 at 20:50
@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 Connor
Aug 24 '15 at 20:50
3
3
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
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
|
show 2 more comments
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 Freedesktop.org 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.
+1 for$XDG_DATA_HOME
. How did you get that?
– jobin
May 18 '14 at 18:08
4
@Jobin is all in the specification. ramendik.ru/docs/trashspec.html
– 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
2
@hellodear2trash-empty
empties the trash. You only need to run it. The binary is in thetrash-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
Nowgio trash --empty
, at least on Ubuntu 18.10/Gnome 3.
– J. B. Rainsberger
Feb 14 at 14:30
add a comment |
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 Freedesktop.org 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.
+1 for$XDG_DATA_HOME
. How did you get that?
– jobin
May 18 '14 at 18:08
4
@Jobin is all in the specification. ramendik.ru/docs/trashspec.html
– 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
2
@hellodear2trash-empty
empties the trash. You only need to run it. The binary is in thetrash-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
Nowgio trash --empty
, at least on Ubuntu 18.10/Gnome 3.
– J. B. Rainsberger
Feb 14 at 14:30
add a comment |
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 Freedesktop.org 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.
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 Freedesktop.org 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.
answered May 18 '14 at 18:06
BraiamBraiam
52.6k20138223
52.6k20138223
+1 for$XDG_DATA_HOME
. How did you get that?
– jobin
May 18 '14 at 18:08
4
@Jobin is all in the specification. ramendik.ru/docs/trashspec.html
– 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
2
@hellodear2trash-empty
empties the trash. You only need to run it. The binary is in thetrash-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
Nowgio trash --empty
, at least on Ubuntu 18.10/Gnome 3.
– J. B. Rainsberger
Feb 14 at 14:30
add a comment |
+1 for$XDG_DATA_HOME
. How did you get that?
– jobin
May 18 '14 at 18:08
4
@Jobin is all in the specification. ramendik.ru/docs/trashspec.html
– 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
2
@hellodear2trash-empty
empties the trash. You only need to run it. The binary is in thetrash-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
Nowgio trash --empty
, at least on Ubuntu 18.10/Gnome 3.
– J. B. Rainsberger
Feb 14 at 14:30
+1 for
$XDG_DATA_HOME
. How did you get that?– jobin
May 18 '14 at 18:08
+1 for
$XDG_DATA_HOME
. How did you get that?– jobin
May 18 '14 at 18:08
4
4
@Jobin is all in the specification. ramendik.ru/docs/trashspec.html
– Braiam
May 18 '14 at 18:10
@Jobin is all in the specification. ramendik.ru/docs/trashspec.html
– 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
@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
2
2
@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
@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
Now
gio trash --empty
, at least on Ubuntu 18.10/Gnome 3.– J. B. Rainsberger
Feb 14 at 14:30
Now
gio trash --empty
, at least on Ubuntu 18.10/Gnome 3.– J. B. Rainsberger
Feb 14 at 14:30
add a comment |
With trash-cli installed type trash-empty
to install trash-cli type
sudo apt-get install trash-cli
This looks safer
– Nabil Kadimi
Jul 31 '17 at 11:30
add a comment |
With trash-cli installed type trash-empty
to install trash-cli type
sudo apt-get install trash-cli
This looks safer
– Nabil Kadimi
Jul 31 '17 at 11:30
add a comment |
With trash-cli installed type trash-empty
to install trash-cli type
sudo apt-get install trash-cli
With trash-cli installed type trash-empty
to install trash-cli type
sudo apt-get install trash-cli
edited Mar 31 '15 at 3:24
Elder Geek
27.5k1055130
27.5k1055130
answered Mar 31 '15 at 0:39
dimitris arvanitidisdimitris arvanitidis
10711
10711
This looks safer
– Nabil Kadimi
Jul 31 '17 at 11:30
add a comment |
This looks safer
– Nabil Kadimi
Jul 31 '17 at 11:30
This looks safer
– Nabil Kadimi
Jul 31 '17 at 11:30
This looks safer
– Nabil Kadimi
Jul 31 '17 at 11:30
add a comment |
I had problems with
rm -rf ~/.local/share/Trash/*
So I had to do:
sudo -s
cd ~/.local/share/Trash/
Before typing the next command, make absolutely sure you are in the correct directory, because you can easily delete everything in your home folder this way and there will be no warning.
rm -fr *
And then everything was gone...
Why sudo, and why rm -rf. It's unnecessary.
– mikewhatever
Jul 29 '17 at 8:15
1
@mikewhatever - Whysudo
? Because I had deleted something as a superuser, and so to empty theTrash
, I had to dosudo
to have that privilege. Simplysudo rm -rf /fullabsolutepath
works in one command.
– Harvey
Nov 10 '17 at 23:10
trash-empty and rm -rf ~/.local/share/Trash/* don't work if you delete from root folders. @Cisum's answer worked best for me.
– rainer
Apr 1 '18 at 15:26
wtf is that? I tried this and everything was gone. All data gone from my system.
– Rajneesh071
May 4 '18 at 7:54
How to revert it back?
– Rajneesh071
May 4 '18 at 7:54
add a comment |
I had problems with
rm -rf ~/.local/share/Trash/*
So I had to do:
sudo -s
cd ~/.local/share/Trash/
Before typing the next command, make absolutely sure you are in the correct directory, because you can easily delete everything in your home folder this way and there will be no warning.
rm -fr *
And then everything was gone...
Why sudo, and why rm -rf. It's unnecessary.
– mikewhatever
Jul 29 '17 at 8:15
1
@mikewhatever - Whysudo
? Because I had deleted something as a superuser, and so to empty theTrash
, I had to dosudo
to have that privilege. Simplysudo rm -rf /fullabsolutepath
works in one command.
– Harvey
Nov 10 '17 at 23:10
trash-empty and rm -rf ~/.local/share/Trash/* don't work if you delete from root folders. @Cisum's answer worked best for me.
– rainer
Apr 1 '18 at 15:26
wtf is that? I tried this and everything was gone. All data gone from my system.
– Rajneesh071
May 4 '18 at 7:54
How to revert it back?
– Rajneesh071
May 4 '18 at 7:54
add a comment |
I had problems with
rm -rf ~/.local/share/Trash/*
So I had to do:
sudo -s
cd ~/.local/share/Trash/
Before typing the next command, make absolutely sure you are in the correct directory, because you can easily delete everything in your home folder this way and there will be no warning.
rm -fr *
And then everything was gone...
I had problems with
rm -rf ~/.local/share/Trash/*
So I had to do:
sudo -s
cd ~/.local/share/Trash/
Before typing the next command, make absolutely sure you are in the correct directory, because you can easily delete everything in your home folder this way and there will be no warning.
rm -fr *
And then everything was gone...
edited Feb 12 at 9:05
Zanna
51.3k13140243
51.3k13140243
answered Nov 3 '14 at 14:27
Cisum inasCisum inas
2002415
2002415
Why sudo, and why rm -rf. It's unnecessary.
– mikewhatever
Jul 29 '17 at 8:15
1
@mikewhatever - Whysudo
? Because I had deleted something as a superuser, and so to empty theTrash
, I had to dosudo
to have that privilege. Simplysudo rm -rf /fullabsolutepath
works in one command.
– Harvey
Nov 10 '17 at 23:10
trash-empty and rm -rf ~/.local/share/Trash/* don't work if you delete from root folders. @Cisum's answer worked best for me.
– rainer
Apr 1 '18 at 15:26
wtf is that? I tried this and everything was gone. All data gone from my system.
– Rajneesh071
May 4 '18 at 7:54
How to revert it back?
– Rajneesh071
May 4 '18 at 7:54
add a comment |
Why sudo, and why rm -rf. It's unnecessary.
– mikewhatever
Jul 29 '17 at 8:15
1
@mikewhatever - Whysudo
? Because I had deleted something as a superuser, and so to empty theTrash
, I had to dosudo
to have that privilege. Simplysudo rm -rf /fullabsolutepath
works in one command.
– Harvey
Nov 10 '17 at 23:10
trash-empty and rm -rf ~/.local/share/Trash/* don't work if you delete from root folders. @Cisum's answer worked best for me.
– rainer
Apr 1 '18 at 15:26
wtf is that? I tried this and everything was gone. All data gone from my system.
– Rajneesh071
May 4 '18 at 7:54
How to revert it back?
– Rajneesh071
May 4 '18 at 7:54
Why sudo, and why rm -rf. It's unnecessary.
– mikewhatever
Jul 29 '17 at 8:15
Why sudo, and why rm -rf. It's unnecessary.
– mikewhatever
Jul 29 '17 at 8:15
1
1
@mikewhatever - Why
sudo
? Because I had deleted something as a superuser, and so to empty the Trash
, I had to do sudo
to have that privilege. Simply sudo rm -rf /fullabsolutepath
works in one command.– Harvey
Nov 10 '17 at 23:10
@mikewhatever - Why
sudo
? Because I had deleted something as a superuser, and so to empty the Trash
, I had to do sudo
to have that privilege. Simply sudo rm -rf /fullabsolutepath
works in one command.– Harvey
Nov 10 '17 at 23:10
trash-empty and rm -rf ~/.local/share/Trash/* don't work if you delete from root folders. @Cisum's answer worked best for me.
– rainer
Apr 1 '18 at 15:26
trash-empty and rm -rf ~/.local/share/Trash/* don't work if you delete from root folders. @Cisum's answer worked best for me.
– rainer
Apr 1 '18 at 15:26
wtf is that? I tried this and everything was gone. All data gone from my system.
– Rajneesh071
May 4 '18 at 7:54
wtf is that? I tried this and everything was gone. All data gone from my system.
– Rajneesh071
May 4 '18 at 7:54
How to revert it back?
– Rajneesh071
May 4 '18 at 7:54
How to revert it back?
– Rajneesh071
May 4 '18 at 7:54
add a comment |
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?
2
This was posted 3 years ago. We need something that spells this out including what version it works for here in 2017
– SDsolar
Jul 29 '17 at 6:53