Recovering evince session in Ubuntu 16.04

1

How can I recover documents which were open in Evince prior to a system crash in Ubuntu 16.04? Ideally, I would like to find a list of files which were open just before the crash. At the least, I would like to find some sort of history.

I did a crash simulation on another computer and found out that after opening evince after an unexpected shutdown it does offer a list of "recently viewed filed". Where is this list of recently opened (in Evince) files stored in Ubuntu 16.04? Can I also extract the dates when each document was opened or at least the order in which they had been opened?

I tried using gvfs-info, but the result produced looked rather unsystematic: it both showed files which were opened a long time ago, but never recently, and did not show files which were opened during the crashed session. Is there a more efficient way of using gvfs for my purpose?

D.T.

Posted 2018-12-18T15:35:22.540

Reputation: 11

Could try searching all files in your home for some of the specific filenames, with grep for example – Xen2050 – 2018-12-18T18:35:25.500

@Xen2050: Thank you for the very good suggestion! It looks like there is a hope to recover the previous session by looking more carefully in gvfs-metadata and .cache/thumbnails/large/ I am more hopeful about the latter, because the cache files are date-stamped. Do you know the rules for creating those thumbnails? Are they created every time a new document is opened in Evince or another application? When are they deleted? – D.T. – 2018-12-18T21:23:42.210

Answers

0

Evince 3.18.2 (which is the version that comes with the current Ubuntu 16.04) uses Gtk's mechanism of storing recently-used files in .local/share/recently-used.xbel .

You can either read this XML file directly, or use Gtk methods to interpret it, for example, using Python: python2 -c "import gtk; print('\n'.join([o.get_uri() for o in gtk.RecentManager().get_items() if o.get_mime_type()=='application/pdf']))"

See the GNOME documentation for documentation of the latter method (along with ways to get timestamp of when the file was last visited etc.)

Christoph Sommer

Posted 2018-12-18T15:35:22.540

Reputation: 361

Thank you for the answer! Unfortunately, in my case, recently-used.xbel is almost empty even though there had been a dozen of pdf's open at the time of the crash. The crash, by the way, happened when the laptop's battery completely discharged and somehow failed to suspend. – D.T. – 2018-12-18T18:56:37.937

Hmm. So you are saying evince shows lots of files as "recently viewed", but recently-used.xbel is almost empty? In this case, I'm stumped. – Christoph Sommer – 2018-12-18T19:08:35.110

I am sorry. Your answer is definitely correct. I just checked on another computer and indeed Evince writes quite a lot of history into recently-used.xbel. On that computer it shows "recently viewed" files. However, I am much more interested in Evince on another laptop which crashed because of the battry discharge. On this laptop recently-used.xbel is unfortunately empty and I hesitate launching Evince. I actually do not know if it will show any "recently viewed" files there. – D.T. – 2018-12-18T19:52:32.257

Maybe I can use Zeitgeist? In fact, it contains a ton of data. I just do not know how to handle it. More specifically, I do not know how to transform Zeitgeist's "timestamp" into human-readable date. Or maybe some binary file can help? – D.T. – 2018-12-18T19:57:14.340