10

How can I read what is written to /dev/tty*(* = 0 - number of tty)?

I tried sudo tail -f /dev/tty1 on one terminal(X) and then sudo cp .emacs /dev/tty1 from another. X didn't show the the content of .emacsbut pressing Ctrl-Alt-F1 I could see the content of the .emacs.

Background.

Is this question of the same category as this?

10

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.

  • These surely are some abstruse ideas to come to terms with. Isn't part of what is being printed become a part of the display buffer? – Bleeding Fingers Oct 17 '13 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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