Reputation: 2393
I have a pi that is connected to my TV via hdmi. It's setup to automatically login at boot to the console (not x-windows). In order to control the screen's output on my TV, I must use the keyboard connected to my pi.
I want to be able to login to the pi via ssh and then hijack the tty1 stdin stream, but still allow the stdout to be the hdmi interface. How can I do this?
I looked at 'screen' but it looks like it takes over both stdin and stdout without the ability to choose just stdin.
root@nana ~ # uname -a
Linux nana 3.4.104+ #1 SMP PREEMPT Thu Jan 8 15:40:40 CET 2015 armv7l GNU/Linux
Upvotes: 5
Views: 6584
Reputation:
The easiest thing to do here is open up another shell and have it's output redirected into your tty1 stdout stream.
script
is an excellent program for capturing output of a program to a file. For example, you could do:
script -t0 /dev/tty1 bash
The -t
parameter makes script
flush its buffer to /dev/tty1
on every character press, rather than every newline.
Note that this isn't going to be controlling the tty1 shell. Rather, it is simply shoving output from a new shell into it.
If you wanted to have a single, persistent shell shared between tty1 and ssh, you could use screen
/tmux
. On your tty1, open up a session (either manually or on login). Then you can simply ssh in and attach to it. Both tty1 and ssh will have control over the exact same session, simultaneously.
Upvotes: 6