Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
Repeat:
  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

2 Answers 2

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

 
discard

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.