Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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

 
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.