Can I SSH into my Pi and have a monitor reflect the activity?
Is there a way to force a refresh of the monitor via SSH?
My setup doesn't include a keyboard so SSH is my current option.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityCan I SSH into my Pi and have a monitor reflect the activity?
Is there a way to force a refresh of the monitor via SSH?
My setup doesn't include a keyboard so SSH is my current option.
You can use script
to do so. Script will write (or append) your terminal session into a file.
You can append it to the tty that is being displayed in your monitor.
In RaspBSD you can do:
# script -a -F /dev/ttyv0
and it works flawlessly.
I guess the default tty
will change between different distributions, so you should look which one is the default in your system (it is listed under /dev/ttysomething)
The script utility makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
I would suggest using screen
(sudo apt-get install screen
) you can open a command line on the graphical interface, then type screen
and it will open a normal looking command line. Then from SSH you can screen -x
which will attach the previous screen. To leave the screen, you press ctrl + a
then d
for disconnect.
Here is a pretty helpful page for random information: https://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/
‘-x’ Attach to a session which is already attached elsewhere (multi-display mode). Screen refuses to attach from within itself. But when cascading multiple screens, loops are not detected; take care.
It seems that you could use usbip to forward input from your USB keyboard and mouse to another computer (usbip server) to your RPi (usbip client) over the network. That way you'll be able to use those keyboard and mouse as if they were connected to your RPi, instead of using SSH.
Another similar project is netevent, which is dedicated to sharing of input devices, as opposed to usbip which shares any USB devices (drives, webcams, etc.) There's also barrier
.
There's also this SU question which lists a few alternative solutions: x2x, Synergy and evdev+netcat.
You could tell the syslog daemon (on Raspbian the package rsyslog is used by default) to write according log messages also to /dev/console
which is the currently active text console under Linux. (This assumes that no X is running. If you have X running, there is a tool called xconsole
in the package x11-apps which shows these messages in an X window.)
Additionally you might need to either disable screen blanking permanently (may damage your screen) or make the screen unblank in case of such an event.
The commands to control screen blanking are xset
under X and the setterm
on the Linux text consoles.
I though do not know how to trigger a command if a specific message is written to the syslog. One solution might be to also pipe these log messages into a script which checks every input line for the according messages and calls the above mentioned commands if a match is found.