7

I have two computers with Ubuntu 12.04 and 13.10 both desktop versions. On the 12.04 I have opened terminal and process running in it. The process is displaying some states information and allows changing some setting on the fly. So, I want to access the 12.04 from the other PC and manage the process.

I have successfully connected to the PC using SSH, but I was not able to find how to see the process in the terminal.

1

2 Answers 2

6

I believe the tool you are looking for is screen. Be aware that it breaks scrollback due to how it works.

Set up as follows:

screen -mS myscreen

Attach as follows:

screen -x myscreen

Once attached, you or your partner can interact with the screen.

Detach from the screen as follows:

Ctrl-A D

Don't get that backwards, or you log out of your screen and take your partner's with you! If you close the window without detaching, it will close your partner's screen as well.

To list active screens:

screen -ls

To attach to one of two similarly named screens:

screen -x 12345.myscreen

where 12345 is the PID of the screen (which you get from screen -ls)

Found a source for this! http://wiki.networksecuritytoolkit.org/nstwiki/index.php/HowTo_Share_A_Terminal_Session_Using_Screen

1
  • 1
    You can also use tmux. I prefer tmux over screen
    – dfc
    Feb 21, 2014 at 0:01
5

If you're trying to access an interactive process like ftp or a game server, you'll only be able to control it from the terminal that created it. That said, there's a program called screen that you can use to create a virtual terminal that can be opened inside other terminals.

To install:

sudo apt-get install screen

To start a screen terminal:

screen -S nameOfScreen

Or if you want to create a screen without connecting to it immediately:

screen -dmS nameOfScreen

And to start a program inside a screen immediately, add the command at the end:

screen -dmS ftpstuff ftp [options for ftp]

You can also reconnect with:

screen -r nameOfScreen

And run a command without entering the screen (useful for scripts):

screen -S gameServer -p 0 -X stuff "alert We're running a backup, expect a bit of lag.$(printf \\r)"

You can disconnect from screen by hitting Ctrl+A followed by Ctrl+D. Try Ctrl+A followed by ? for more help, or read the man page.

You must log in to answer this question.

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