OK lets admit you connect a display to a computer that runs linux.
The display will show a login screen asking for user and password.
I am logged in via SSH on pts/0

I can now run a program on TTY1 like this

some-program > /dev/tty1 2>&1

But what I am looking for is a possibility to just show my console to tty1 without the user to be able to interfere. I tried:

screen > /dev/tty1 2>&1

but it opened the screen on pts/1 instead ot tty1. I tried

top > /dev/tty1 2>&1

result was a dark screen any hint?


The openvt command, present in the kbd package on Debian, deals specifically with using VTs.

For example you can run top on /dev/tty8 with:

openvt -c 8 -- top

It takes care itself of preparing the correct detached environment for the forked command (redirecting I/Os to the VT, calling setsid(2) etc.) and returns immediately.

I avoided /dev/tty1 in this example because very often first /dev/ttyX are already used to spawn login prompts.

Use chvt (eg chvt 8) if you have to change the VT to be displayed.

You can also choose to not specify the VT and let openvt pick the first available, and immediately switch to it using -s, So this would work in one shot:

openvt -s -- top

Be careful to not leave older instances running then...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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