Linux – How to get Linux to interpret keyboard charaters properly

keyboardlinuxputtyshell

I access a linux server shell via putty, but many of the keys I use do not translate across,
up, down, left and right all are seen as ^[[A, ^[[B, ^[[D and ^[[C;
But so is C-up, C-down, C-left and C-right.
And enter is seen as C-j (which move down to the next line),
and backspace is seen as C-h, which is backwards delete.

How can I stop these keys being translated into other keys (so I can, for example, configure C-h and backspace to perform two different functions) and what's doing this translation (Putty, the kernel, the shell)?

Best Answer

  • Try changing $TERM to "xterm".

    Try setting PuTTY's keyboard settings to "rxvt", "Esc[n~" and "Control-?".

    What shell are you using? If it's Bash then there are some settings you might want to make in ~/.inputrc.

    Keypress interpretation is affected by a combination of:

    • PuTTY - or other terminal emulator
    • The OS you're running the terminal emulator on
    • /etc/X11/xorg.conf - if you're using the X-Window system.
    • Bash/Readline via /etc/inputrc and ~/.inputrc - or similar features in other shells
    • terminfo or in some cases termcap
    • The $TERM variable
    • Probably something I'm forgetting
  • Related Question