This question really started from here. I would like to know why different terminals like rxvt and xterm use different values when mapping key combinations? Whilst I am in rxvt or xterm how can I find out the value of a key sequence and easily add this to the .inputrc file?
You can find out what control sequence a key generates in a particular terminal by typing Ctrl+V then the key (in most shells, or in the input of a command such as
Fortunately, there are almost no conflicts among the control sequences sent by various terminals. The main exception is that some terminals send
What Gilles said. As for the particular case being referred to, the VT100 and VT220 terminals (which is what today's terminal emulators try to emulate) didn't have keycodes for modifier+arrow key combinations, hence emulators introduced their own.
Not sure exactly why xterm and rxvt have different ones, but perhaps they were introduced independently at the same time. Actually xterm originally used shorter codes than it does today, but those caused problems so were changed eventually.
These days most terminal emulators, in particular the ones for the various desktop environments (including OS X), try to emulate xterm. Rxvt-unicode still carries on the rxvt tradition though.