How to create a screenshot of the Linux command line shown on the monitor - No X running

I need to see the monitor of the linux system I am connected to by SSH. I know I can dump the contents of the console as ASCII characters, but this won't show me how the characters are rendered exactly. I'd like to receive a PNG or the like so I can see the real contents of the monitor.

The kernel does not use a framebuffer console but the standard one.

IMPORTANT: Because my other question was closed by someone: There is no X running on the console! I want to do a snapshot of the console you get e.g. by pressing Alt-F1 or by sending chvt 1 to the kernel. This is usually a plain text console, and I want to screenshot THAT, not some X session running somewhere.

I know I cannot display that screenshot in SSH, of course. That's why I want a PNG or some other raw format containing the pixels of that console.


Solution 1:

You mentioned there's no framebuffer, just BIOS text mode.

In BIOS 80x25 text mode, there are no pixels – the kernel just directly puts text and attributes in the VGA memory, and the display adapter renders it somehow. (Hence "text mode".) The only way to make a screenshot of text-mode tty would be to physically capture from the VGA/HDMI/DP output, but it is out of reach for the OS.

(The OS can load a custom font into the VGA memory, e.g. Linux allows arbitrary .psf format fonts to be used, but you can't really know which font is currently loaded.)

If the text console had been running in framebuffer mode (using Linux's FBCON), you could screenshot that through /dev/fb0 using fbgrab.

Additionally, if the remote system was a server with a BMC (baseboard management controller, such as DRAC or iLO) built in, then that BMC would typically offer a "remote console" or "vKVM" feature which is able to show the screen's contents regardless of mode, by having the BMC directly access the display adapter's memory after it had already rendered the text. Some "business" desktops may also have this available through Intel AMT, although it needs to be pre-configured.