0

This question already has an answer here:

I have a machine which is hooked up to a physical display and to which I have ssh & root access, but which does not have a mouse or keyboard. It does not have X installed. I would like to run some commands such that their output is displayed on the physical display.

My thought was that I should just write to /dev/tty1, as I only needed to send keypresses, not receive data. And it worked - kind of. The display is sitting at the login prompt, so running

echo "myusername" | sudo tee /dev/tty1

does in fact cause my username to fill in the field in the physical display! But it never goes to the password prompt...sending newlines does not seem to be the same as a physical press of the enter key. I have tried

echo -ne "\n" | sudo tee /dev/tty1
echo -ne "\r\n" | sudo tee /dev/tty1
echo -ne "\0" | sudo tee /dev/tty1

All just seem to add more blank lines to the username field. Is there a trick?

marked as duplicate by Mark Plotnick, Community Jun 12 at 21:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Have you considered using a terminal multiplexer like screen or tmux instead? You get the added benefit of keeping your session alive after you log out as well.

On the machine hooked up to the monitor:

sudo apt install screen

To start a session, use:

screen -S nameOfSession

To attach to the session, use:

screen -r nameOfSession

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