Question

So I'm currently sshing into a remote server and doing a job that takes a while. To monitor it I have to see the terminal output log that the program outputs. But when I detach it and come back to the server I only see the latest page of output. How can I see all the output ever since detachment? I'm using byobu to detach btw.

Thank you in advance.

-Oak

Was it helpful?

Solution

I do not know byobu but as long as it keeps the terminal open so that the program keeps running, you can do ordinary command line magic. Start the program and redirect its output to a file. You then can watch the file:

program-doing-much > /tmp/some-file.log

You can either run that command in the background using &, or you can simply open a new "virtual terminal" and issue the tail -f /tmp/some-file.log there.

You can also use tee so that you can keep watching the program running and, when needed, read the complete log file later on.

program-doing-much | tee /tmp/some-file.log

Keep in mind that you are only redirecting stdout. If the program gives information on stderr, you have to redirect that as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top