4

Suppose I opened up a screen to run some program that outouts some result.

Once the program finishes, is there a way to get the result in the screen from outside.

For example:

  1. I opened up a screen using "screen -S myscreen"
  2. I detached from the screen
  3. The program in screen finishes
  4. I want the result in the screen by command like screen --get-result-from myscreen

PS:

I am currently deploying a distributed task over several machines. I need someway to get the result without visiting each screen individually.

UPDATE:

Any way to copy part of the content in screen? As there might be other irrelevant information.

4
  • 6
    screen -S myscreen -X hardcopy some-file would save the content of the screen to a file. You could also use logging. Commented Dec 1, 2014 at 17:24
  • What if I want to copy only a part of the useful information? Any way to do that? Commented Dec 1, 2014 at 19:44
  • 2
    Why not have the process that you're running log itself? Or if you want only, say, the last 20 lines of output, then /path/to/myscript.sh arg arg arg | tail -n20 > /path/to/process_log.txt
    – DopeGhoti
    Commented Dec 1, 2014 at 20:32
  • Interactively you can do it by marking part of the screen, copying it to the paste buffer, and then writing this to a file, but there doesn't seem to be a way to script this. Looks like you'll have to write the whole screen to a file, and then edit it from there.
    – Barmar
    Commented Dec 4, 2014 at 6:00

1 Answer 1

-1

Ctrl+A,Esc and then you will be able to scroll up for the whole screen output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .