According to this question tty only recognize character input and the rest of function keys F[1-12] as a char sequence.

I have a CUI application runs over wineconsole and expects a F12 key press, all is executed on tty session (ctrl+alt+f[1-6]). Now I can send the expected char sequence for the F12 using ctrl+[ [24~ or esc [24~ but that would be counter-intuitive and less memorable to send a function key using their char sequence.

So my question: is there any way that I can bind or config the tty terminal to recognize an F12 keypress (and the rest of the function keys) as ... well as an F12.

here is the output of my F12 keypress using showkey command in tty terminal

kb mode was 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)...
keycode  28 release
keycode  88 press
keycode  88 release

and here is the output of the tput

F1 ^[[[A
F2 ^[[[B
F3 ^[[[C
F4 ^[[[D
F5 ^[[[E
F6 ^[[17~
F7 ^[[18~
F8 ^[[19~
F9 ^[[20~
F10 ^[[21~
F11 ^[[23~
F12 ^[[24~

Thanks in advance

1 Answer 1


My bad, it seems the problem is with the wineconsole not the terminal itself. The terminal accepted the keystroke all right but it seems not being recognized by the CUI application running in curses mode.

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.