Have you ever used the vi -r command to recover a file? It lets you get back a file you were editing when the system crashed or something else killed your editor before you could save. The system will send you a mail message ( 1.33 ) something like this:
Date: Tue, 19 Nov 91 09:59:00 EST To: jerry A copy of an editor buffer of your file "afile" was saved when the system went down. This buffer can be retrieved using the "recover" command of the editor. An easy way to do this is to give the command "vi -r afile". This works for "edit" and "ex" also.
Warning! | Your files are saved under a directory named something like /usr/preserve . Follow the instructions and you'll get back your file, more or less the way it was when you lost it. |
---|
If your computers have networked filesystems, such as NFS, there's a wrinkle in the way that vi -r works. It may only work right on the specific computer where you were editing a file. For example, if you're editing the file foo on the host named artemis and it crashes... you may not be able to log on to another host and do vi -r foo to recover that file. That's because, on many hosts, temporary files (like editor buffers) are stored on a local filesystem instead of on the networked (shared) filesystems. On this kind of system, you may need to log on to artemis to recover your lost editor buffer.
If you don't remember which computer you were using when the file was lost, check the "Received:" lines in the email message header; they'll often show which machine the message originally came from. Also, if you don't remember what files are saved on a machine, you can usually get a list of your saved files by typing vi -r without a filename:
/tmp |
% |
---|
Don't wait too long. Most UNIX systems remove these saved editor buffers every month, week, or even more often.
-