1

My question is related to Keyboard and Console, but I want to do it for an arbitrary pseudo terminal, and not just the built-in Linux ones.

Also, I'm not interested in a stream, I just want the current state.

I'd imagine that if I cat the resulting file with the cursor at 0x0 and same terminal settings, the screen would look exactly like it did when the snapshot was taken.

1 Answer 1

1

AFAIK normal shell, nor default Linux console don't provide such facilities, but many terminal emulation programs do - e.g. KDE's Konsole has the option "Save output as..."

If your current terminal emulator doesn't support that (e.g. you're on the system console, text mode, or on a genuine serial terminal, not emulated), you can always launch the GNU Screen command: screen. It provides hundreds of rich functionalities to the console, and among them there's hardcopy - ctrl-A h saves currently visible screen contents to a file hardcopy.[nr]. More on the subject in the documentation.

4
  • I'd like to do it programmatically... Nov 29, 2013 at 17:28
  • @JanusTroelsen: screen -X allows you to send arbitrary command to an already running screen session, so you can execute the command to dump a hardcopy from a script running outside Screen.
    – SF.
    Nov 29, 2013 at 17:34
  • It also doesn't handle Unicode or colors :( Nov 29, 2013 at 18:43
  • @JanusTroelsen: I'm fairly sure it does, but you'll need to give the config files some TLC.
    – SF.
    Nov 29, 2013 at 19:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .