2017-11-14

Save GNU screen buffer to file

To save the content of a screen in the "GNU screen" tool to a file, including the scrollback buffer, do the following:

- Press Ctrl-A and then :
- Enter "hardcopy -h myfile.txt"

myfile.txt will be created in the current working directory of the screen instance you are connected to.

This is useful in situations where you think "I should have really redirected that into a log file". Of course this only works well if you have a big scrollback buffer. I have:

defscrollback 100000

in my .screenrc.



2017-10-27

Reset screen terminal after printing garbage

When accidentally printing binary data in a terminal the state of the terminal gets messed up and one needs to reset it. When using GNU screen, this is maintaining part of the terminal state as well.

To reset it:
- press Ctrl-A
- enter ":reset" and press enter

Done. You many need to enter "reset" in the terminal itself as well.