I'm have a monitor connected to my Pi via HDMI. There is no GUI OS installed, only the command line. I don't have a keyboard, so I'm SSHing into my Pi.

I have a python script that displays some text. I want to, from my SSH session, cause that python script to display its text on my HDMI connected monitor, instead of in my SSH console. Hopefully that makes sense.

Any suggestions?

  • With bash I use the DISPLAY environment variable to select the output. I don't know how to do it within a python script. Have look to define or redirect the output channel instead of default stdout.
    – Ingo
    Oct 24, 2020 at 22:55

1 Answer 1


Got it figured out. Just have to write to /dev/tty1.

In python:

f = open('/dev/tty1', 'w')
# write to stream you just opened

This only works for linux btw.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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