6

I have an unsaved document opened in gedit on Xubuntu 13.10. A bug caused gedit's main window to disappear and only the title bar is still visible, reading "Untitled Document 1".

Is there a way to recover the typed text from the running but defunct session of gedit? Are "Untitled Documents" stored somewhere temporarily?

7
  • cat /path/"Untitled Document 1~" > ~/Desktop/file.txt Mar 17, 2014 at 19:22
  • The problem is that I don't know where the file is located or if it solely exists in RAM. Is it maybe possible to issue console commands to running instances of programs?
    – wundervoll
    Mar 17, 2014 at 19:25
  • locate "Untitled Document 1~" Mar 17, 2014 at 19:27
  • Returns nothing. :-(
    – wundervoll
    Mar 17, 2014 at 19:31
  • 1
    Did you actually save the document as "Untitled Document" (or was this purely in memory on an unsaved text)? Mar 17, 2014 at 19:36

2 Answers 2

8

The file only seemed to be stored in RAM. All attempts to find it on disk returned nothing. Here's what I did for partial recovery:

  1. Find out PID and write it down

    ps -ef | grep gedit
    
  2. Use it to dump memory of process

    sudo gcore 12345
    
  3. Use vim and search for keywords you remember

    sudo vim core.12345
    

The entire file will be fragmented, can be quite big and is littered with parts you have deleted already. Since I was not programming, but wrote an actual text, I was able to find the individual fragments and recover a large part of the text.

Ironically, after I went through all of this work and wanted to close the gedit instance it asked me if I want to save the Untitled Document 1 - which I did.

1
  • You just saved me 4 hours of work! TY
    – Kudin
    Nov 3, 2016 at 22:01
0

When you open a file with gedit it will create a temporary file with ~ in the name.

so just force close gedit and you can reopen that file

gedit /path-to-file/filename~

or just go to the directory from nautilus file manager

ctrl + h will show you the hidden file then search for it and open.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .