Linux Commands Examples

A great documentation place for Linux commands


report or set the keyboard mode

see also : loadkeys


kbd_mode [ -a | -u | -k | -s ] [ -C CONSOLE ]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


if [ "$UTF8" = "yes" ]; then
/usr/bin/kbd_mode -u -C /dev/console
printf "\033%%G" >> /dev/console
echo 1 > /sys/module/vt/parameters/default_utf8
echo 1 > /sys/module/vt/parameters/default_utf8
/usr/bin/kbd_mode -a -C /dev/console
printf "\033%%@" >> /dev/console


Without argument, kbd_mode prints the current keyboard mode (RAW, MEDIUMRAW or XLATE). With argument, it sets the keyboard mode as indicated:

-s: scancode mode (RAW),

-k: keycode mode (MEDIUMRAW),

-a: ASCII mode (XLATE),

-u: UTF-8 mode (UNICODE).

Of course the "-a" is only traditional, and the code used can be any 8-bit character set. With "-u" a 16-bit character set is expected, and these chars are transmitted to the kernel as 1, 2, or 3 bytes (following the UTF-8 coding). In these latter two modes the key mapping defined by loadkeys(1) is used.

kbd_mode operates on the console specified by the "-C" option; if there is none, the console associated with stdin is used.

Warning: changing the keyboard mode, other than between ASCII and Unicode, will probably make your keyboard unusable. This command is only meant for use (say via remote login) when some program left your keyboard in the wrong state. Note that in some obsolete versions of this program the "-u" option was a synonym for "-s".

see also


How can this site be more helpful to YOU ?

give  feedback