Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
possible duplicate of How to keep processes running after ending ssh session? –  Jorge Castro Feb 27 at 17:57

2 Answers 2

up vote 5 down vote accepted

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

share|improve this answer
1  
You can also use tmux. I prefer tmux over screen –  dfc Feb 21 at 0:01
    
@dfc Thanks, I'll give that a try. –  The Dude Feb 21 at 17:51

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.