LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Blogs > ultimate_linux
User Name
Password

Notices

Rate this Entry

alternative to rm command

Posted 06-16-2010 at 09:00 AM by ultimate_linux

i've seen many users deleting files and reporting how to recover them.
instead of recovering i've thought of redirecting the files deleted to trash.so,that it might be helpful to recover them.
here's how i do it.

1.take a variable,for example:TRASHPATH.
2.assign the exact path of trash to that variable.
most likely,trash path will be /home/username/.Trash.
3.here's the code just paste this into your .bashrc file.

##################code starts here
TRASHPATH=/home/username/.Trash
function rem()
{
for i in $*
do
mv $i $TRASHPATH/$i
done
}
##################code ends here


now,if you want to delete files just issue the command
rem file1
you can give multiple files also
rem file1 file2 file3 file4 file5 etc.

p.s:instead of trash,you can direct to another folder also
don't include a slash(/) at the end of path in TRASHPATH variable
Posted in Uncategorized
Views 2015 Comments 4
« Prev     Main     Next »
Total Comments 4

Comments

  1. Old Comment
    yep, you are right, this did has a great help for recovering!!!!
    Posted 06-16-2010 at 09:00 PM by twwwater twwwater is offline
  2. Old Comment
    thank you my dear friend.
    Posted 06-17-2010 at 11:13 AM by ultimate_linux ultimate_linux is offline
  3. Old Comment
    NOTE:the path of trash can also be ~/.local/share/Trash
    Posted 06-19-2010 at 06:45 AM by ultimate_linux ultimate_linux is offline
  4. Old Comment
    There is still no sub for frequent backups and organisation.
    Posted 06-20-2010 at 07:36 PM by 2ck 2ck is offline
 

  



All times are GMT -5. The time now is 08:19 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration