2 Answers
2

These keys are not sent to terminals. Only printable characters, function keys, and combinations of these keys with modifiers are sent to terminal applications (most function keys are sent in the form of escape sequences beginning with ESC [). Modifier keys (like CapsLock, Shift, etc.) are visible to GUI applications, but not to terminal applications. You won't be able to detect a press of these keys in vim or tmux. See What is bash's meta key? for more background.

With the Fn on many laptops, it's even worse: this key is handled by the BIOS and not even visible to the operating system.

showkey will dump out the code for any key you press. You probably want showkey -s (although no options works well, too). I pressed SHIFT (the 0x9a is ENTER coming back up):

$showkey -s
kb mode was in UNICODE
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)
0x9a
0x2a 0xaa

Like the warning says, don't try it under xterm (or any X program). It needs a real tty to read from.