I'm connecting to a Solaris machine from WinXP using PuTTY.

When I try to use the NumPad keys for editing a command in Bash (Home, End, Delete) a ~ character is instead printed to the console. Relevant envirnoment parameters as follows:


Can I configure PuTTY to get the NumPad keys working?


The path of least resistance is to tell your shell on the Solaris box what the escape sequences sent by PuTTY mean. You see a ~ because these keys emit an escape sequence like ​␛[3~ where ​ is the escape character (\e, ASCII 27). Type Ctrl+V followed by one of the keys so that the ​ character is inserted literally, followed by the other characters. Then define bindings in the relevant file, which for bash is ~/.inputrc:

"\e[1~": beginning-of-line     # Home
"\e[4~": end-of-line           # End
"\e[5~": beginning-of-history  # PageUp
"\e[6~": end-of-history        # PageDown
"\e[3~": delete-char           # Delete
"\e[2~": quoted-insert         # Insert
"\eOD": backward-word          # Ctrl+Left
"\eOC": forward-word           # Ctrl+Right

Install a terminfo entry (this can be done in your home directory if you do not have root access; you may need to set the TERMINFO variable) corresponding to the actual keys sent by putty. TERM=vt220 or vt420 might actually be close enough, but then you lose color.

This page has some that might work - install terminfo entries with tic, and if necessary you can get termcap data with infocmp -C.

If this doesn't work, you could experiment with different settings for function keys in the putty settings: if it's just home and end that don't work, try xterm - if nothing works, maybe try SCO ANSI and then set the terminfo to e.g. something corresponding to e.g. freebsd console which uses the same keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.