Ctrl-Left and Ctrl-Right not working on Linux console

Your problem

You are used to navigate wordwise by hitting Alt-Left/Right or Ctrl-Left/Right on the command line. Neither of those work on the Linux console. The Alt-combinations switch the console instead. And Ctrl-Left/Right does nothing.

Solution

Bind Ctrl-Left/Right to the keycodes Alt-b and Alt-f. Those are interpreted by readline as word navigation commands. Do it like this:

First create a file /usr/local/wordnav.keys with this content:

control keycode 105 = Meta_b
control keycode 106 = Meta_f

Then load this file using loadkeys:

 # loadkeys /usr/local/wordnav.keys
Loading /usr/local/wordnav.keys

Now Ctrl-Left/Right navigates word-wise even on the console.

Making this permanent

You probably want to make this permanent. Here is a solution for SuSE Linux (tested on 9.0, but should work on 8.x as well).

After loading the new keys dump the complete keymap into a file /usr/local/mykeymap:

# dumpkeys > /usr/local/mykeymap

SuSE configures within the file /etc/sysconfig/keyboard which keymap file is to be loaded. Here you set the variable KEYTABLE:

# Keyboard settings for the text console
#
# Keyboard mapping
# (/usr/share/kbd/keymaps/)
# e.g. KEYTABLE="de-latin1-nodeadkeys", "us" or empty for US settings
#
KEYTABLE="/usr/local/keymap"

Keywords: console ctrlleft ctrlright altleft altright word commandline suse90 suse   Author: Mathias Kettner

Tauschzone MK