Command to move a file to Trash via Terminal
I would like to know if there is a command I can issue in a terminal so I do not classically remove (rm
) the file, but instead move it to trash (i.e. Nautilus Move to Trash behavior).
In case there is such a command, I would also be interested in knowing what it is.
Solution 1:
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
Solution 2:
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