Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

3 Answers 3

up vote 27 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.