Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We would like to save the output of a program run on a Linux console which spans many lines. Unfortunately it wasn't logged or run under screen, or any other way that lets us easily capture the output. The best method we've been able to come up with so far is:

Log into the machine via a separate SSH session
In the console session, page to the top of the buffer
  In the SSH session, run "cat /dev/vcs >> screendump.txt"
  In the console session, page down one screen
Dump the final screen in the SSH session

Is there a better way? It seems like if the VC memory were contiguous and you knew where it was you could use dd to pull the console text directly out of kernel memory and into a file.

share|improve this question

setterm can dump the contents of a Linux virtual console:

setterm -file log.txt -dump [ttynumbers]

However, it does not have access to the scrollback buffer, only to what's currently displayed.

share|improve this answer

Unless VGACON_SOFT_SCROLLBACK is set to "Y", the scrollback buffer is in VGA memory rather than system memory.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.