[sf-lug] switching from ssh server to terminal: can it be done and if so, how?
rick at linuxmafia.com
Mon Feb 11 17:41:40 PST 2008
Quoting Alex Kleider (a_kleider at yahoo.com):
> Here's the scenario: while at work I ssh (using putty on a windows
> machine although I don't _think_ that part is relevant) on to my home
> computer where I begin to use mutt to compose an email to a friend. In
> the midst of my vim session composing the body of the message I get
> distracted and end up going home forgetting all about the message until
> I'm at the computer on which is running the ssh server handling that
> unfinished job.
> Here's the question: can I switch that job to a terminal so that I can
> complete the message and send it off?
One way (though this somewhat exceeds your requirements): Immediately
after you login to your Linux box, before you start Mutt, run "screen".
This is a terminal multiplexer. For reasons that I'll make clear, you
can just make a habit of typing "screen -dr".
A terminal multiplexer means that "screen" will immediately give you
back a terminal session _but also_ can give you as many more as you
wish, all accessible from your single PuTTY window. To create a second
such terminal session, do "ctrl-A ctrl-C" (i.e., create terminal).
"ctrl-A ctrl-N (i.e., next terminal) will take you to the next "screen"
terminal session, cycling around to the first such session if you keep
The magic bit: If you merely shut down PuTTY's window, and do _not_
logout, "screen" will keep running all the apps you have started in
"screen's" various terminal sessions. Next time you ssh in, doing
"screen -dr" will tell screen to detach and reattach, which in effect
reconnects you to the running sessions.
(screen is addictive and a way of life. Be aware that your ISP may
be well aware of this fact, and so may run a cronjob to kill users'
screen sessions periodically.)
More information about the sf-lug