Customizing the Linux Console

25 Feb

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

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.

After login I can choose whether I want to start an Xsession or not; more about that later.

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 had to remove again: \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Ă :

fbdump-issue-motd

Next Post Previous Post