0

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.
Shan Khan
  • 1,351

1 Answers1

1

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:

disown
exit

Second session:

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

tail -f logfile
Jos
  • 30,529
  • 8
  • 89
  • 96