Recover Unsaved Work from a nano .save File
<p>When the GNU <strong>nano</strong> editor is killed or your terminal closes mid-edit, nano writes an emergency dump of your buffer to a <code>.save</code> file: an unnamed buffer becomes <code>nano.save</code>, a named file becomes <code>yourfile.txt.save</code> (and <code>.save.1</code>, <code>.save.2</code> if those exist). It is a plain text copy of your unsaved work — just open it to get your content back. nano has <em>no</em> interactive recover prompt like Vim; the <code>.save</code> file is the whole recovery mechanism. Steps below.</p>
What the nano .save file actually is
nano does not keep a live swap file while you type the way Vim does. Instead, when it receives a fatal signal (terminal closed, SSH dropped, kill, out-of-memory), its emergency handler dumps the current buffer to disk once before dying. That dump is the .save file. Because it's a one-shot snapshot at the moment of death, it holds everything you had typed up to the crash — but nothing after.
- Unnamed buffer (you ran
nanowith no filename): the dump isnano.savein the directory you launched from. - Named file (
nano notes.txt): the dump isnotes.txt.savein the same directory as the original. - Name already taken: nano appends a number —
notes.txt.save.1,.save.2, and so on — so an old dump is never overwritten.
Recover your text, step by step
- Go to the directory where you were editing. Show hidden-ish names too:
ls -a. - Look for
*.save(ornano.save). Check the timestamp withls -l --time-style=full-iso *.saveto confirm it's from the crash. - Open it to read your work:
nano notes.txt.save(orcat/lessto just view it). - It's already plain text — no conversion needed. Copy what you need, or save it over the real file:
mv notes.txt.save notes.txtafter you've checked it looks right. - Delete leftover
.savedumps once recovered so they don't confuse the next session:rm notes.txt.save*.
If there is no .save file
nano only writes the emergency dump if it got a signal it could handle. A hard power loss or kill -9 leaves no .save — the handler never runs. In that case your unsaved buffer is gone; nano has no journal or autosave to fall back on. Two things reduce the risk next time:
- Enable backups: run
nano -B file(or setset backupin~/.nanorc). nano then keeps afile~copy of the last saved version on each save — not your live buffer, but a safety net against bad saves. - Save often:
Ctrl+Owrites the buffer without exiting. The.savedump is a last resort, not a substitute for saving.
Note: the nano .save file is unrelated to a Vim .swp swap file or a .swo/.swn — those belong to Vim and are recovered differently. If you see .swp instead, you were in Vim, not nano.
FAQ
What is a .save file created by nano?
It's an emergency dump of your editing buffer that nano writes if it is killed or the terminal closes mid-edit. An unnamed buffer becomes nano.save; a named file becomes yourfile.save. It's plain text — just open it to recover your unsaved work.
How do I recover my text from a nano .save file?
Go to the directory you were editing in, run ls -a to find the *.save file, and open it with nano or view it with cat/less. It's already plain text, so copy out what you need or rename it back over the original with mv yourfile.save yourfile.
Why is there no .save file after my nano crash?
nano only writes the .save dump when it receives a signal its handler can catch (terminal closed, SSH dropped, kill). A hard power loss or kill -9 skips the handler, so no .save is created and the unsaved buffer is lost. Enable backups with nano -B and save often with Ctrl+O to reduce the risk.
Is a nano .save file the same as a Vim swap (.swp) file?
No. A .swp is Vim's live swap file, updated continuously while you edit and recovered via Vim's own prompt. nano's .save is a one-shot snapshot written only at the moment of a crash. If you see a .swp you were in Vim, not nano.
Other file types explained
- Recover an Unsaved File in VS Code After Closing or a Crash
- What Is a .laccdb File? (Access Lock File You Can Delete)
- What Is a .~lock File? (LibreOffice Lock File)
- What Is a ~$ File? (Word & Excel Owner File)
- What Is a .LOG File?
- What Is a .OLD File?
- What Is an .OPDOWNLOAD File? (Opera unfinished download)
- What Is a .PNF File? (Windows precompiled INF)