On Linux, you can dump the current text that is displayed on a text mode console through the vcs devices. For example, cat /dev/vcs1
dumps the content of /dev/tty1
. The vcsa devices (e.g. /dev/vcsa1
) contain text attributes as well.
Every time you open /dev/vcsNUM
, you get the current content of the terminal's display buffer. This isn't an interface to what is currently being printed to the terminal — there's no such interface.
For pseudo-terminals, what is currently displayed is tracked by the terminal emulator, and there is no way to dump it unless the terminal emulator provides one. For example, for a pseudo-terminal provided by ssh, the terminal content would be on the client machine.