Have you ever used the vi -r command to recover a file? It lets you get a file back that you were editing when the system crashed or something else killed your editor before you could save. The system may send you an email message something like this:
Date: Thu, 19 Nov 1999 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.
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 you don't remember which computer you were using when the file was lost, check the "Received:" lines in the email message header;[49] they'll often show from which machine the message originally came. 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:
[49]Many email programs hide these header lines from you. You might need to set a "show all header fields" option first.
% vi -r /var/preserve/jerry: On Wed Jul 17 at 08:02 saved 15 lines of file "/u/jerry/Mail/drafts/1" On Sun Aug 25 at 18:42 saved 157 lines of file "doit" /tmp: No files saved.
Don't wait too long. Many Unix systems remove these saved editor buffers every month, week, or sooner.
-- JP
Copyright © 2003 O'Reilly & Associates. All rights reserved.