Customizing the Linux Console

A collection of tricks that also have an effect on the non-graphical environment, a.k.a. the console.

Keep boot messages on tty1

I do not use a display manager or splash screen. When my computer boots, I see all messages, then a login prompt. By default the screen would clear before the login prompt shows up, but I have disabled that.

Log into X or CLI

After login I can choose whether I want to start an Xsession or not on tty1. Put this at the end of ~/.bash_profile (if bash is your login shell):

if [[ $XDG_VTNR -eq 1 ]] then export XSESSION=openbox printf "[38;5;1m Press <Enter> to start Xorg with $XSESSION or anything else for command line:[m(B " oldifs="$IFS" IFS= read -s -n 1 key echo # -s: do not echo input character. -n 1: read only 1 character if [ -z "$key" ]; then IFS="$oldifs" unset key oldifs echo "$XSESSION" > /tmp/currentXsession [[ -z $DISPLAY ]] && echo "Starting $XSESSION..." && sx else IFS="$oldifs" unset key oldifs fi fi

If you want to have a choice of startup commands, have a look here.

Issue and motd

Both files, if present, contain information that will be displayed just before login (/etc/issue) and just after (/etc/motd).

On a single user system there isn't much use for motd (message of the day) - all it does is display a message after you login, and that can be achieved better with ~/.profile or ~/.bash_profile or similar.

I am much more interested in having a nice message before I login, which can be achieved via /etc/issue. Besides normal text, there's quite a lot this file can contain. Please have a look at man agetty and scroll down to ISSUE ESCAPES.
So we have colors, date, time, network information etc. It can even query /etc/os-release, so should my distro decide to change its name I won't have to edit /etc/issue ;-)

There's a little twist though: some escapes are updated every 10s; this might be desirable for some, but it also clears the screen which I disabled on purpose. These are the escapes I cannot use: \t \4 \6.

And this is how it looks now:

\S{ANSI_COLOR}\S{NAME}\e{reset} \r on \d (\e{lightred}\l\e{reset})
\U already logged in.\S{ANSI_COLOR}

You see how the last color is not reset? This has the effect that the login prompt is displayed in the same color as the distro name. But if I don't reset it, all subsequent text will keep that color. This is where motd is useful after all.

While still being root, I entered tput sgr0 > /etc/motd - voilà: