Remote sharing of a terminal

2

2

At work, I fire-up a terminal and start executing some huge process(which may take couple of hours to complete) and leave office. When I reach home, I want to check what is happening to the process(not just checking if it is still running or not but to see the output as well). Is there a way to get connected to the same terminal and view the ongoing process.

Basework: I tried reading about this utility called screen. But it allows my remote machine to attach to the session that I started at work. It doesn't allow me to connect to that shell and see the progress.

ganessh

Posted 2013-08-14T10:13:01.570

Reputation: 131

Actually, in my understanding, shell are run by screen, so by reattaching to a screen session through another connection mean, you effectively get back the shell you were using. This requires to be run by this way : (work) ssh to the server, run screen, run command un shell ran by screen, detach from screens ession. (home) ssh to server, reattach to the screen session, and BAM you're at the same place. With suffisent tuning it even allows multi-users at the same time. – mveroone – 2013-08-14T12:07:29.243

Answers

8

screen does exactly that. But you have to start the process in screen.

To create the session use

screen -S hugeprocess

To resume the session

If the screen is still running:

screen -x hugeprocess

If the screen has been detached:

screen -r hugeprocess

To detach from the session

CTRL + A+D

Enable screen log file

You may also want to use the -L parameter when you create the session to enable logging to ~/screenlog.0 which you can read using less -r screenlog.0

choroba

Posted 2013-08-14T10:13:01.570

Reputation: 14 741

+1 because not only is screen GNU, but it comes preinstalled in most Linux distributions. For the record, tmux is an alternative. – mveroone – 2013-08-14T12:08:50.813

screen -r hugeprocess is correct if the screen is already detached with Ctrl+A+D. – Harikrishnan – 2013-08-16T10:30:02.153

2

Try reptyr:

reptyr - Reparent a running program to a new terminal

user218473

Posted 2013-08-14T10:13:01.570

Reputation:

Can you give a more specific example of how this solves the problem? – slhck – 2013-08-14T10:40:42.317

1(This assumes using ssh from the home machine into the work machine) Work machine: hugeprocess.sh Home machine: reptyr $(pgrep hugeprocess.sh) – justbrowsing – 2013-08-14T11:04:43.387