I have a file open on my desktop PC at home, which I want to read now I'm at work.
It's just some notes I started writing in a new document in gedit, it's not been saved (I don't think, anyway).
I have SSH and NX access to my home desktop. If I connect with NX I get access to my home desktop GUI but not to the session I have currently open with the document in it.
Suggestions?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 07/09/2010 09:22, Mark Rogers wrote:
I have a file open on my desktop PC at home, which I want to read now I'm at work.
It's just some notes I started writing in a new document in gedit, it's not been saved (I don't think, anyway).
I have SSH and NX access to my home desktop. If I connect with NX I get access to my home desktop GUI but not to the session I have currently open with the document in it.
If you know or remember where you created the document in the first place, then maybe your editor has created an auto-backup/shadow file, which you could open remotely. At least that approach works in Vi[m]: for any open file, Vi creates .file.swp, which it periodically updates without user intervention (unless that feature has been disabled) - this can be easily read with "vi -r .file.swp", even though the original editor session is still attached. this is probably trickier if the file does not yet have a name, but I think it then creates a backup with a random filename in the interim.
Not much help with gedit, probably, but it's a suggestion nevertheless :-)
Simon
- -- ====================================================================== Simon Ransome http://nosher.net Photo RSS Feed: http://nosher.net/images/images.rss
On 07-Sep-10 08:53:26, Simon Ransome wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 07/09/2010 09:22, Mark Rogers wrote:
I have a file open on my desktop PC at home, which I want to read now I'm at work.
It's just some notes I started writing in a new document in gedit, it's not been saved (I don't think, anyway).
I have SSH and NX access to my home desktop. If I connect with NX I get access to my home desktop GUI but not to the session I have currently open with the document in it.
If you know or remember where you created the document in the first place, then maybe your editor has created an auto-backup/shadow file, which you could open remotely. At least that approach works in Vi[m]: for any open file, Vi creates .file.swp, which it periodically updates without user intervention (unless that feature has been disabled) - this can be easily read with "vi -r .file.swp", even though the original editor session is still attached. this is probably trickier if the file does not yet have a name, but I think it then creates a backup with a random filename in the interim.
Not much help with gedit, probably, but it's a suggestion nevertheless :-)
Simon
I had a similar thought (vim user too, me)! However, some experimentation drew a blank. I started 'gedit temp.txt'. With ls -latr there was no new file in the directory where the gedit session was opened (though I had typed stuff into the gedit window); and all I could find in /tmp was a socket: srwxr-xr-x 1 ted ted 0 2010-09-07 09:59 gedit.ted.3678969524
I might be that if I waited long enough then gedit might (as Simon describes for vim) automatically save something. I'll leave the session up, and if anything happens I'll let you know!
Also, sending SIGINT or SIGHUP to the gedit process simply closed it, without anything being saved that I could find.
Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 07-Sep-10 Time: 10:17:05 ------------------------------ XFMail ------------------------------
On 07/09/10 09:22, Mark Rogers wrote:
I have a file open on my desktop PC at home, which I want to read now I'm at work.
It's just some notes I started writing in a new document in gedit, it's not been saved (I don't think, anyway).
I have SSH and NX access to my home desktop. If I connect with NX I get access to my home desktop GUI but not to the session I have currently open with the document in it.
Suggestions?
Snazziest way is to ssh into your home machine, run "DISPLAY=:0.0 x11vnc", then connect to your machine with a vncviewer (from work over ssh tunnels, or from your NX session), to give you full access to your existing X session. Note the security warning about passwords that x11vnc prints, and act accordingly.
If you just want to see the gedit window to read it, just take a screen snapshot of your existing session: ssh in, run "DISPLAY=:0.0 xwd -root -out screen1", then scp screen1 to work or open it in your NX session with gimp. That only works if all your text is visible on the screen of course.
If you don't want to bother with remote graphic access and you want the actual text to edit, you could use "gcore" to generate a coredump of the process, and the "strings" the resulting core file to see if you can recover the text.
If you run a "gedit filename.txt" multiple times from one session it re-uses the existing one... you could try that from your NX session, although I'd be surprised if that worked.
There may be some snazzy way to use dbus-send to remote control gedit to save the file somewhere, but I haven't looked into that.
-- Martijn
On 07/09/10 10:37, Martijn Koster wrote:
Snazziest way is to ssh into your home machine, run "DISPLAY=:0.0 x11vnc", then connect to your machine with a vncviewer (from work over ssh tunnels, or from your NX session), to give you full access to your existing X session.
This worked perfectly, thanks.
I connected using VNC to localhost from my NX session, but I'll play around with ssh tunnels for future reference.
As well as being "snazzy" this is really the option I was hoping to have, as it's more generally useful than all the other possible hacks.
If you don't want to bother with remote graphic access and you want the actual text to edit, you could use "gcore" to generate a coredump of the process, and the "strings" the resulting core file to see if you can recover the text.
I tried this out of curiosity, and everything I needed was there provided I knew enough about what I needed to find the signal amongst the noise; if I knew enough to find it I probably wouldn't have needed to go through the exercise! Surprising just how much was in the dump, not least because of how little had anything to do with that gedit session.
If you run a "gedit filename.txt" multiple times from one session it re-uses the existing one... you could try that from your NX session, although I'd be surprised if that worked.
My first attempt had been to run gedit, hoping that I had already saved the file and that I could look at the recent files list to see where I'd saved it. But gedit didn't open (it presumably just re-used the old session that I couldn't access).
Thanks (also to Steve & Ted) for your suggestions (and experiments), all very welcome.
On 07-Sep-10 10:08:04, Mark Rogers wrote:
On 07/09/10 10:37, Martijn Koster wrote:
Snazziest way is to ssh into your home machine, run "DISPLAY=:0.0 x11vnc", then connect to your machine with a vncviewer (from work over ssh tunnels, or from your NX session), to give you full access to your existing X session.
This worked perfectly, thanks.
I connected using VNC to localhost from my NX session, but I'll play around with ssh tunnels for future reference.
As well as being "snazzy" this is really the option I was hoping to have, as it's more generally useful than all the other possible hacks.
If you don't want to bother with remote graphic access and you want the actual text to edit, you could use "gcore" to generate a coredump of the process, and the "strings" the resulting core file to see if you can recover the text.
I tried this out of curiosity, and everything I needed was there provided I knew enough about what I needed to find the signal amongst the noise; if I knew enough to find it I probably wouldn't have needed to go through the exercise! Surprising just how much was in the dump, not least because of how little had anything to do with that gedit session.
If you run a "gedit filename.txt" multiple times from one session it re-uses the existing one... you could try that from your NX session, although I'd be surprised if that worked.
My first attempt had been to run gedit, hoping that I had already saved the file and that I could look at the recent files list to see where I'd saved it. But gedit didn't open (it presumably just re-used the old session that I couldn't access).
Thanks (also to Steve & Ted) for your suggestions (and experiments), all very welcome.
-- Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450 Registered in England (0456 0902) @ 13 Clarke Rd, Milton Keynes, MK1 1LG
Glad you got it solved, Mark! I just had a look at the things you can do from the gedit task bar. Under "Edit" --> "Preferences" --> "Editor" you will find:
File Saving: [] Create a backup copy before saving [on by default] [] Autosave files every [...] minutes [off by default]
Once set, this persists across sessions. So, for future benefit, you could set the "Autosave" and then you would find a "saved" version if the gedit session had run for the set length of time.
I just tested it (using a 5-minute setting) and what I had typed in in my "gedit temp.txt" session was duly there in the saved file "temp.txt".
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 07-Sep-10 Time: 11:58:49 ------------------------------ XFMail ------------------------------
On 07 Sep 09:22, Mark Rogers wrote:
I have a file open on my desktop PC at home, which I want to read now I'm at work.
It's just some notes I started writing in a new document in gedit, it's not been saved (I don't think, anyway).
I have SSH and NX access to my home desktop. If I connect with NX I get access to my home desktop GUI but not to the session I have currently open with the document in it.
Suggestions?
On the other end install x2vnc, fire up that to point at the currently running desktop and connect to the vnc server that it'll start using an ssh tunnel, save the file, jobs-a-goodun.