This question already has an answer here:

I want to achieve the following scenarios:

  1. Connect to remote machine via SSH
  2. Run command on remote machine - that usually takes 3 days to complete and shows output while working
  3. Leave the SSH connection without killing that command terminal process
  4. Connect to remote machine from other machine and see the running output of command.

marked as duplicate by Jos, George Udosen, guiverc, pLumo, WinEunuuchs2Unix May 16 at 10:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1st thing that comes to mind is a detached Screen. Am I understanding? – EODCraft Staff May 16 at 9:31
  • @EODCraftStaff can we detach screen from one console and connect the screen from other machine ? – Shan Khan May 16 at 10:23
  • @Jos "Connect to remote machine from other machine and see the running output of command." - do you think its possible? – Shan Khan May 16 at 10:25
  • In the first session, you would need to redirect STDOUT output to a file. In the next session, you would do tail -f filename to see the running output. – Jos May 16 at 10:27
  • @Jos can you post an example for this so i can see. the process will be constantly writing output to console that runs via ssh – Shan Khan May 16 at 10:45

First session:

command >> logfile &

Executes command in the background and redirects STDOUT output to a file. Watch the output:

tail -f logfile

Press Ctrl+C to stop viewing the output (not the process itself).

Detach the process from the current session and exit:


Second session:

See the current output of the (still running) process:

tail -f logfile

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