Command to move a file to Trash via Terminal
You can use gvfs-trash
command from the package gvfs-bin
which is installed by default in Ubuntu.
Move file to trash:
gvfs-trash filename
See the content of the trash:
gvfs-ls trash://
Empty the trash:
gvfs-trash --empty
Install trash-cli – sudo apt-get install trash-cli
Put files in the trash with: trash file1 file2
List files in trash: trash-list
Empty trash with: trash-empty
As of 2017, gvfs-trash
seems to be deprecated.
$ touch test
$ gvfs-trash test
This tool has been deprecated, use 'gio trash' instead.
See 'gio help trash' for more info.
You should use gio
, specifically
gio trash
is the recommended way.