The website of Lei Chen

Sunshine and rain of a developer

How to save GNU screen scroll buffer

Posted by hide1713 on February 27, 2011

If you use gnu screen, I am sure this tip will be useful someday. If you ran some programs for hours and want to dump the whole scroll buffer to a file. Here’s how:

Ctrl-a :hardcopy -h dump_file.

Note: the dump_file might have many empty line at the beginning, you might need to scroll down a little bit to see the content.

Do NOT use the Ctrl-a [ copy buffer for super big block, screen might die!

From screen user manual:

18.1 hardcopy

— Command: hardcopy [-h] [file]

(C-a h, C-a C-h)
Writes out the currently displayed image to the file file, or, if no filename is specified, to hardcopy.n in the default directory, where n is the number of the current window. This either appends or overwrites the file if it exists, as determined by the hardcopy_append command. If the option -h is specified, dump also the contents of the scrollback buffer.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.