Showing results for 
Search instead for 
Did you mean: 

PuTTY: key mapping

Marco Müller
Occasional Advisor

PuTTY: key mapping


we're using PuTTY and Reflection to access our HP-UX Servers (and Linux too). I currently using the dtterm emulation. PuTTY works fine with dtterm emulation, but I'm missing something like "keyboard mapping" which is availlabe in Reflection.
For example the "home" and "end" keys are not working with PuTTY. Does somebody knows a possibility to map some escape sequences to a key or something like that to solve that issue?

Marco Mueller
Court Campbell
Honored Contributor

Re: PuTTY: key mapping

Based on the link below from the PuTTY website I am going to say that if you are looking for this functionality you are goin to have to use another program.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Marco Müller
Occasional Advisor

Re: PuTTY: key mapping

Oh oh, that doesn't sound very nice. :-( But I think you're right. Perhaps there is another terminal type which works. Perhaps somebody knows one...
-> I don't want to use another term emu! PuTTY is so uncomplicate. I liked it before the "keymapping issue" happend. :-)
Marco Mueller
Honored Contributor

Re: PuTTY: key mapping

I think I remember that using a terminal type of vt220 instead of xterm got a few keys working in putty, like pgup/pgdown. I don't think I ever needed home/end, so I can't speak to those. I never did get all of the F-keys working.
Volker Borowski
Honored Contributor

Re: PuTTY: key mapping

Hi Marco,

I have version 0.58 here an Help section 4.4.2 has something about HOME/END

[quote PUTTY help]
The Unix terminal emulator rxvt disagrees with the rest of the world about what character sequences should be sent to the server by the Home and End keys.

xterm, and other terminals, send ESC [1~ for the Home key, and ESC [4~ for the End key. rxvt sends ESC [H for the Home key and ESC [Ow for the End key.

If you find an application on which the Home and End keys aren't working, you could try switching this option to see if it helps.

May be you can switch this flag ?
Bill Hassell
Honored Contributor

Re: PuTTY: key mapping

HP-UX (specifically your shell) understands plain ASCII characters (see man ascii), but all those special keys do not exist. Unlike PCs or Xwindows where the keyboard is handled very differently, those special keys (arrows, PgUp, Home, etc) must be specifically by each program (shell included). Now when you press one of those special keys, the action depends on your terminal emulator as well as the program you are using. If the emulator is put into 'local execute' for the special keys, then the nothing is sent to the computer -- the keys work offline and just move the cursor or screen. If the program tells the emulator to 'transmit functions' then (depending on your emulator) two or more characters are sent to the computer and nothing happens to your local screen.

Now if the program understands these special codes (something like ESC h when you press the HOME key) then the program interprets the two characters and sends codes to your terminal screen to move the cursor and reposition the file display as necessary. This is exactly what happens in vi. I suspect you may be asking the question relative to vi in which case, the answer is found in the .exrc file. In this file, settings and keymaps are defined, essentially taking special character sequences and mapping them to a vi command.

NOTE: .exrc is NOT self configuring. HP-UX supplies a very nice one for HP terminals ONLY. Unfortunately, WRQ has a family of emulators and they all have the name Reflection, but they are VERY different. Reflection/X is an Xwindow emulator and since you said dtterm, I suspect you are using Reflection/X (and not the true terminal emulators for HP or DEC/Unix or the web version of Reflection).

In Xwindows, you are 'stealing' services from your HP-UX computer. dtterm (and xterm and hpterm) are not running on your PC but are running on HP-UX and sending the graphic images to your PC Xwindow emulator. So dtterm's behavior is defined by that program.

PuTTY is very different from Reflection/X. It runs only on your PC and opens a telnet or ssh connection. All the keyboard features are defined by the PuTTY emulator and the way you have it configured. You'll need to spend time in the PuTTY docs to figure out the special keys. And be careful about .exrc -- it must match your terminal.

Bill Hassell, sysadmin
Occasional Visitor

Re: PuTTY: key mapping

Have you tried setting the keyboard type in PuTTY to Xterm R6?  (Category: --> Keyboard --> Xterm R6)

Dennis Handly
Acclaimed Contributor

Re: PuTTY: key mapping

> Have you tried setting the keyboard type in PuTTY to Xterm R6?  (Category: --> Keyboard --> Xterm R6)


Hmm, I recently had to do that too.  I got a new laptop layout and instead of the Pg-up/Pgdn keys, they were on the numeric keypad.  I later figured out where they hid them, somewhere hard to reach.  :-(

ranganath ramachandra
Esteemed Contributor

Re: PuTTY: key mapping

I'm not sure if this will help, but "FWIW":

I have a .inputrc mainly for bash on HP-UX.

[ arwen ~ ] $ cat .inputrc
set editing-mode emacs
set horizontal-scroll-mode on

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[7~": beginning-of-line
"\e[8~": end-of-line

"\e[3~": delete-char

When I login through PuTTY and type <Home><End><Enter><Ctrl-D> to od, I get this:

[ arwen ~ ] $ od -xc
0000000    1b5b    317e    1b5b    347e    0a00
       033    [    1    ~    033    4    ~    \n

So it looks like the first two mappings are covering the PuTTY case (the next two seem to work for HP-UX/Linux terminals). The last line maps the "Delete" key.

(i work for hpe)

Accept or Kudo