Some info about Linux console

Most people never need to worry about the Linux keyboard and console HOWTO. Although it's written in 2002, I still find it worth reading, and below is a summary.

The kbd package contains important programs to tweak console settings. It also contains data such as keymaps and fonts. Debian family likes to split packages so the data resides in another package known as console-data. There's also a kbd clone, namely console-tools.

When a key is pressed, the keyboard controller sends scancode to the kernel keyboard driver. Unless in scancode mode, the driver parses scancodes into keycodes. Unless in keycode mode, the keycodes are looked up in the keymap (which can be changed with loadkeys or xmodmap), and the characters found there are transmitted to the application. The program showkey can examine scancodes and keycodes. Under X, use xev.

Fonts are loaded into the video card's character ROM, and can be changed using setfont.

Why is it that you sometimes get a lot of line-drawing characters, e.g., after catting a binary to the screen? Well, there are various character set changing escape sequences, and by accident your binary might contain some of these.

Bash, Emacs and X all do their own tty input handling.

By default, to get a screen to scroll, Linux leaves the text in video memory as it is, but change the viewing origin. The kernel console driver will write text starting at the top of the video memory, continuing to the bottom, then copy the bottom part to the top again, and continue. You can scroll back until the top of the video memory by using Shift-PageUp and scroll down again using Shift-PageDown, assuming a default keymap. The amount of scrollback is thus limited to the amount of video memory you happen to have and you cannot increase this amount. Upon changing virtual consoles, the screen content of the old VT is copied to kernel memory, and the screen content of the new VT is copied from kernel memory to video memory. Only the visible screen is copied, not all of video memory, so switching consoles means losing the scrollback information.

Free Palm Pre

Excellent post, i have bookmarked it for future referrence

Post new comment

The content of this field is kept private and will not be shown publicly.