Ubuntu keeps its trash in ~/.local/share/Trash/files, and stores metadata (ie. deleted from where, deleted when) in a sibling info/ folder. This script tries to move files to trash just as the file browser would do, so you can easily restore it later.
Save it as trash (or whatever you like) in your $HOME/bin folder (don't forget to chmod u+x it), and use it instead of rm.
# A shell script for moving files and folders to your (Gnome) trash can,
# allowing to restore files from the file browser.
until [ "$#" = "0" ];do
fullpath=`find $pwd -maxdepth 1 -name "$1"`;
mv $1 "$TRASH_FILES" &&
echo "[Trash Info]
DeletionDate=$trashdate" > "$trashinfofile" &&
echo "Moved $fullpath to $TRASH_FILES and updated trash metadata." ||
echo "Could not move $fullpath to $TRASH_FILES, or could not update trash metadata!";
Thanks to george9233 for the beginning of this script.
That was fun! But the really easy version is
sudo apt-get install trash-cli