Screen
To write the entire contents of the scrollback buffer to a file
Ctrl + A and : to get to command mode then:
hardcopy -h <filename>
Cannot open your terminal '/dev/pts/0' - please check
backup@myserver:~/nginx/20161025$ screen -r 13542 Cannot open your terminal '/dev/pts/0' - please check.
To solve this issue:
backup@myserver:~/nginx/20161025$ script /dev/null Script started, file is /dev/null
And then I'm able to re-attach to this screen again.