ARCHIVED: In vi, can I retrieve a document I was editing when I lost my connection?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

If you were disconnected from a Unix system while in an editing session using vi, you can still retrieve your document. When the system detects the loss of your connection, it will retain a copy of your document and send you an email message similar to the following example:

  You were editing the file "myfile.txt"
  at <Sun Jun 22 15:17> on the machine ''somemachine''
  when the editor was killed.
  You can retrieve most of your changes to this file
  using the "recover" command of the editor.
  An easy way to do this is to give the command "vi -r myfile.txt".
  This method also works using "ex" and "edit".

As the message indicates, you can use the vi recover command to retrieve your document.

Note: You cannot be certain your document was saved if you were disconnected because of a crash or other disruption on the remote host.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

Related documents

This is document afhu in the Knowledge Base.
Last modified on 2018-01-18 10:04:32.