Linux – Displaying text on /dev/tty1


I have a server laptop sitting around at home which is a pretty bland server, on which I generally leave the lid open and there is a login prompt always displayed.

However, I'd love to be able to display useful information on /dev/tty1 so whilst the server is just sitting there, rather than displaying a login prompt on the monitor, it could now display, for example, the current time and weather forecast for the day. Or something along those lines.

Does anyone know how to go about this? I've tried searching for answers but it's not really a common problem/question and this isn't my area of expertise.

Best Answer

You will have to have root access to do this, so su first.

Then, write a script to print whatever you want - for example, the date:

while /bin/true; do
sleep 1

Then, change your /etc/inittab (this may be different for different distros) to use the new program (which you should have chmod +x'd by now and placed in /usr/local/bin) to this:

# These are the standard console login getties in multiuser mode:
c1:12345:respawn:/usr/local/bin/ &> /dev/tty1 < /dev/tty1
c2:12345:respawn:/sbin/agetty 38400 tty2 linux

Remember to add the redirection operators ("&> /dev/tty1 < /dev/tty1") - init does not redirect output on its own.

Reboot and tty1 will show the output of the script after you are done booting.

Related Question