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 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.

share|improve this question
Have a look at this answer. – Peachy Nov 6 '12 at 8:49
Also a good resource here: – Rinzwind Nov 6 '12 at 8:52
up vote 40 down vote accepted

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
share|improve this answer
Also visit my gvfs-question. – Pandya Sep 17 '14 at 14:47

Install trash-cli Install trash-clisudo apt-get install trash-cli

Put files in the trash with: trash-put file1 file2

List files in trash: trash-list

Empty trash with: trash-empty

share|improve this answer

I like the low tech ways the best. I made a folder /.Tr in my home directory by typing:

$ mkdir ~/.Tr

and instead of using rm to delete files move those files to the ~/.Tr directory by typing:

$ mv fileName ~/.Tr

This is an effective and simple way of keeping access to files you think you don't want with the added benefit in my case of not messing with the systems folders as my Ubuntu knowledge levels are fairly low and I worry about what I might be screwing up when I mess with system stuff. If you are also low level please note that the "." in the directory name makes it a hidden directory.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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