Search code examples
linuxpipetty

How to run an interactive console program like htop directly on tty?


i did make an interesting discovery on my raspberry pi. if I run the following as root:

htop > /dev/tty0

Then the output of htop will be printed directly on screen (hdmi connection) I would like to run htop as service, but when I do that in a systemd script it says

systemd error opening terminal unknown

How to solve that? I tried also

cat /dev/null | htop > /dev/tty

Same result...


Solution

  • Set

    [Service]
    StandardOutput=tty
    

    in the .service file. See systemd.exec(5) for details.