Step1. sudo apt-get install trash-cli
Trash-cli:This package provides a command line interface trashcan utility compliant with the FreeDesktop.org Trash Specification. It remembers the name, original path, deletion date, and permissions of each trashed file
Step2. sudo gedit /usr/local/bin/trash-rm
in Ubuntu 10.04 i found it to be sbin than bin so command might be
sudo gedit /usr/local/sbin/trash-rm
Step 3
Paste this content
#!/bin/bash
# command name: trash-rm
shopt -s extglob
recursive=1
declare -a cmd
((i = 0))
for f in "$@"
do
case "$f" in
(-*([fiIv])r*([fiIv])|-*([fiIv])R*([fiIv]))
tmp="${f//[rR]/}"
if [ -n "$tmp" ]
then
#echo "\$tmp == $tmp"
cmd[$i]="$tmp"
((i++))
fi
recursive=0 ;;
(--recursive) recursive=0 ;;
(*)
if [ $recursive != 0 -a -d "$f" ]
then
echo "skipping directory: $f"
continue
else
cmd[$i]="$f"
((i++))
fi ;;
esac
done
trash "${cmd[@]}"
Save and Exit
Set Correct executable rights on the created file
Step:4
sudo chmod +x /usr/local/bin/trash-rm
Step 5:
gedit ~/.bashrc
Step 6:
alias rm = "trash-rm"
Step7:$bash
Re run bash on linux terminal to re run the bashrc
Step8:
Try by creating a file and then using rm -rf "createdFile.txt"
find that file in Trash