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.

  • 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 Aug 14 '13 at 12:07

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


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

  • +1 because not only is screen GNU, but it comes preinstalled in most Linux distributions. For the record, tmux is an alternative. – mveroone Aug 14 '13 at 12:08
  • screen -r hugeprocess is correct if the screen is already detached with Ctrl+A+D. – Harikrishnan Aug 16 '13 at 10:30

Try reptyr:

reptyr - Reparent a running program to a new terminal

  • Can you give a more specific example of how this solves the problem? – slhck Aug 14 '13 at 10:40
  • 1
    (This assumes using ssh from the home machine into the work machine) Work machine: hugeprocess.sh Home machine: reptyr $(pgrep hugeprocess.sh) – justbrowsing Aug 14 '13 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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