INFORMATION!!!!! rm will move deleted data to Trash.........For future recover
As far as how to make stuff go to the trash instead of deleted, run this as root:
Code: mv /usr/bin/rm /usr/bin/rm.bak Now copy this script and save it as /usr/bin/rm: Code: #!/bin/bash mkdir ~/.Trash &> /dev/null while [ ! -z "$1" ]; do mv "$1" ~/.Trash/ shift done --------------------------------------------------- This will, instead of deleting files, move them to the .Trash directory in your home directory, and you can delete them for real later. If there are any comments aor any other soltion to get rid of accidently deleted file,please disucess here... |
Note that 'rm' can also be "/bin/rm", you don't use error detection ("&&") or switch termination (try moving a file called "--help"), backgrounding commands like that could lead to problems when a system is under a high load, you don't use force (should you?) and a while loop like that slows things down. All in all it's a nice try but unfortunately comes nowhere near for instance syscall-intercepting methods like say LD_PRELOAD'ed thrashcan solutions offer.
|
It doesn't support rm command-line switches, so it's not a good idea to use that.
Code:
OPTIONS |
how to get rid of rm -rf if accidenlty used
Please discuess if any of you have the right script that will make getrid of rm -rf comamnd if accidently used.
Waiting---------------- |
Why limit yourself to a script if you can use something like http://freshmeat.net/projects/libtrash/?
|
Quote:
I have an alias that is rm='rm -i' but that does nothing if you throw in the rm -rf. Can you alias a command like rm -rf='rm -rfi'? |
All times are GMT -5. The time now is 03:29 AM. |