I'm using "standard" just in case there's some obvious method, or this feature is part a larger issue that I'm not aware of (as in perhaps involving enabling related shortcuts and features). Otherwise I don't mind just adding my own shortcuts.

  • 1
    On what operating system? FreeBSD? TrueOS? OpenBSD? NetBSD? Illumos? A Linux operating system? ...
    – JdeBP
    Commented Jan 3, 2017 at 8:57
  • I just updated the tags.
    – argle
    Commented Jan 3, 2017 at 9:16

2 Answers 2


If your shell uses the readline library, here is what I have in my default /etc/inputrc file:

# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word

This file is only read if the INPUTRC environment variable is not set, and if you don't have any .inputrc file in your home directory.

Now, we must instruct the console to emit one of the backward-word strings when Ctrl-Left is pressed, and one of the forward-word strings when Ctrl-Right is pressed.

For this, we must add some special keyboard mappings to /etc/console-setup/remap.inc:

# Ctrl + Left arrows key (readline's backward-word)
control keycode 105 = F200
string F200 = "\033[5D"

# Ctrl + Right arrows key (readline's forward-word)
control keycode 106 = F201
string F201 = "\033[5C"

Here I have borrowed two keysyms F200 and F201 (picked up quasi randomly from the output of dumpkeys --long-info) in order to store the sequences expected by readline. keycode 105 is the left arrow, and keycode 106 is the right arrow (those keycodes were obtained with dumpkeys too).

Now, let's rebuild our new keymap :

setupcon --save-only

It should (re)create the file /etc/console-setup/cached.kmap.gz. You can load it manually with the command:

loadkeys /etc/console-setup/cached_UTF-8_del.kmap.gz

Or, better, similarly to when your machine boots:

service console-setup start


Current Debian releases use /etc/console-setup/cached_UTF-8_del.kmap.gz instead of /etc/console-setup/cached.kmap.gz.

  • You have them (so do I), but do they work? In the non-GUI console? (That would be amazing.)
    – argle
    Commented Jan 3, 2017 at 10:21
  • @argle have you tried it yourself? Commented Jan 3, 2017 at 10:30
  • @MrShunz Just test them in the kernel console and you'll understand what I mean.
    – argle
    Commented Jan 9, 2017 at 6:57
  • @argle What i meant is that you asked if they work, as if you haven't tried them yourself. That said, I don't have a debian machine at hand, but on my ubuntu system they don't work on tty console (same /etc/inputrc though). Commented Jan 9, 2017 at 9:40
  • 1
    Thanks for this useful answer @xhienne. A few more infos for further readers: The key code for left/right might be 113/114 on some systems. Only some OS-es seem to be off by 8. You can show keycodes with xev, find possible keysyms with sudo dumpkeys -l and keycodes in use with xmodmap -pke and print input codes emacs style (inputrc) with ctrl+v keypress.
    – phil294
    Commented Apr 13, 2021 at 21:50

For Linux console, you can customize your keymap. The place to start is with dumpkeys. That's the standard approach. There's no applicable standard for Linux console bindings, but you can certainly imitate GUI (i.e., xterm as hinted by xhienne).

I don't see a duplicate, but these would be helpful:

  • +1 for the help. I'll test it as soon as I get some time and I'll return with updates.
    – argle
    Commented Jan 3, 2017 at 22:52
  • I did some more reading. It turns out I understood your solution; it was just unrelated to my question. I hope I'll make inputrc work and post the answer here soon.
    – argle
    Commented Jan 9, 2017 at 6:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .