This question already has an answer here:
Can I make a shell script trash files instead of delete them?
In the past I used gvfs-trash but this doesn't appear to exist in Ubuntu 10.10.
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Please refer to this answer. It outlines the way to do it.
Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).
Make sure you have the gvfs-bin package installed. gvfs-trash is part of it.
5 years ago