stealing/viewing a tty/process

Jeremy Henty onepoint at
Wed Apr 11 04:26:18 PDT 2007


> How can I switch tty's between these connections?  Say I started a
> huge command on one tty and the connection broke...., the command is
> now waiting on input from me, but I can't give it because I'm not
> connected to this process/tty, whatever.

I highly recommend GNU screen
<URL:>.  It's a terminal
multiplexer and it's tailor-made for situations like this.  You start
a screen session and run huge_command in the session.  Now
huge_command is attached to a tty inside the session.  You can detach
from the session and log out.  The session is still there and
huge_command is still running.  Later you log back in and reattach to
the screen session.  You're looking at the output of huge_command
again.  The commands running inside the session don't even know you
went away.

You can also start multiple commands inside a session and switch
between their ttys.  While huge_command is running you can start
another shell in the session and carry on working.  Any time you like
you can switch back and see how far huge_command has progressed.  If
you detach from the session both huge_command and your other shell
carry on as if nothing has happened.

If I have to do remote work on a terminal the first thing I do is set
up screen.  Top tip: if you're an emacs junkie you will almost
certainly want to rebind the screen escape key to something other than
the default Ctrl-A.  I use Ctrl-\.

(This all assumes you're connecting to a Unix box, of course.)


Jeremy Henty 

More information about the blfs-support mailing list