Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have run a rm command on one of my files.This file was actually a file named .MR_ASSESS.swp and later when I opened a file MR_ASSESS I cannot find all my data that was there in the .MR_ASSESS.swp file is there any way that I can get this data.
Please help.Any input with this regard is apprciated.
Try foremost or testdisk (both recommended in this thread - I haven't actually tried them myself). Like it says in the thread, you will only be able to recover it if you haven't subsequently overwritten the actual data in the file.
I have run a rm command on one of my files.This file was actually a file named .MR_ASSESS.swp and later when I opened a file MR_ASSESS I cannot find all my data that was there in the .MR_ASSESS.swp file is there any way that I can get this data.
Please help.Any input with this regard is apprciated.
Ajit
You can do one thing, while running rm , you can mv files to trash , so you can recover them from trash or delete the m forever from trash.
This will rename the normal rm file.
PHP Code:
mv /usr/bin/rm /usr/bin/rm.bak
Now create another rm file as /bin/rm
PHP Code:
#!/bin/bash
mkdir ~/.Trash &> /dev/null
while [ ! -z "$1" ]; do mv "$1" ~/.Trash/ shift done
This is if .Trash doesnot exist in your home or comment the 1st line
give it 755 permission.
Now rm will send files to trash and you can recover them or permanently remove them.
Last edited by divyashree; 12-22-2010 at 06:40 AM.
Try foremost or testdisk (both recommended in this thread - I haven't actually tried them myself). Like it says in the thread, you will only be able to recover it if you haven't subsequently overwritten the actual data in the file.
The thread you mention is quite old (2006 / 2007) and seems to hold only crap "advice" in the first few posts (where things should matter): "this requires some other technique that I don't know.", turning the 'rm' command into some weak scripted kludge (see this) and debugfs (only works semi-successfully with non-journalling file systems). Besides foremost or testdisk are not the applications to look for. The first thing to do is actually do nothing except make a bit copy backup with 'dd' or equivalent and store it somewhere safe and (only mount) read-only. First tool to use would be testdisks companion app 'photorec' as it's a file carver (testdisk can access files it primarily is a disk partition scan and repair tool and the signature database for foremost doesn't rival that of photorec). * If you're not familiar with recovery processes it would be good to do some research (we've got quite a few recovery threads) before posting as it'll save the OP time.
Thanks for all your suggestions.SO i think recovery procedures are the only ways that I can use.Are there any preventive measures that I can use.Also all you people keep refering to thrash folder How do I go about creating this folder and setting my rm command such that every time an rm command is run it outputs it to thrash first.
It has a few easy methods of restoring, and can also, if Desktop Trash is enabled, ReMove files so they'll show up in the Trash on KDE, GNOME, or Xfce (for even easier restoration). I haven't tested other GUI environments yet.
It still needs some work, but good enough for beta testing, IMO.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.