0

I have kali linux on my laptop.I have a problem with my keyboard . Whenever i open a terminal some key is pressed automatically and ^[[5~ this character is shown in terminal. Please tell me which key causes this issue. enter image description here

  • This may be correct. Because page down causes ^[[6~ to appear. How do you find which key is mapped to which character. – Balaji S Apr 22 '18 at 4:02
  • 1
    The terminfo database has the set of keys and their sequences. – roaima Apr 22 '18 at 6:44
1

Per the ECMA-48 standard, [ is the 7-bit equivalent to the 8-bit C1 control character CSI. Your terminal emulator, because of massive historical inertia, is acting as if it is not 8-bit clean.

Any terminal input control sequence of the form CSI Ps1 ; Ps2 ~ is a DECFNK control sequence. (Ps2, and thus the ;, are optional, defaulting in the usual ECMA-48 style to 1 if missing.) This is a de facto standard control sequence originating in DEC terminals and copied by other terminals and terminal emulators over the years.

The VT510 Video Terminal Programmer Information documents the DECFNK control sequence on pages 5—53 to 5—53, albeit not with the IBM PC key names that you are used to. It is the Prev Screen key. It is in the upper group of the editing keypad area of this VT320 keyboard:

See the Prev Screen on this VT320 keyboard

You can guess what its IBM PC Model M keyboard equivalent is from that, but when still consulting the doco nonetheless you will also find CSI 5 ~ in table 8—3 on page 8—7 of VT520/VT525 Video Terminal Programmer Information. That table documents that it is engraved Page Up on an IBM PC style keyboard.

Use reference doco like this to look up keyboard control sequences.

Note that this applies to terminals that use the DEC VT protocols. Not all terminals and terminal emulators do. If you encounter an input control sequence beginning with CSI or SS3 that is not in the CSI Ps1 ; Ps2 ~ form, it will usually (unless it is an actual ECMA-48 control sequence) be employing the other widely used protocol, which is the protocol originally adopted for IBM PC keyboard keys on the SCO Xenix console.

The DEC VT doco documents some of these control sequences as its compatibility "SCO Console" mode. These are fully documented in the keyboard(HW) manual page in the SCO Unix System Administrators Reference.

You'll find them used, for example, by the FreeBSD kernel's built-in terminal emulator for function keys F13 and higher. (It uses the DEC VT control sequences for F1 to F12. There are DEC VT control sequences for function keys up to F22. The SCO Xenix console has documented control sequences for function keys F1 to F48, reflecting the common IBM PC convention of using modifier keys to quadruple the number of function keys.)

Further reading

  • Actually no - it's not "SCO console" that you have in mind regarding the modifiers. There's a table in section 4.7 which refers to the extended keyboard feature. The SCO console documentation in the VT520RM doesn't touch on any of that. – Thomas Dickey Apr 22 '18 at 14:33
  • On the contrary: There's an entire chapter right there in VT520RM that is even entitled "SCO Console Emulation Mode", that contains amongst other things a list of the SCO control sequences for function keys. Whereas section 4.7 does not deal in the CSI and SS3 control sequences sent by function keys at all, only in the control sequences received by a terminal to re-program them, which aren't even SS3 or CSI sequences. – JdeBP Apr 22 '18 at 18:20

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.