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.

- 11
1 Answers
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:
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
- VT510 Video Terminal Programmer Information. EK-VT510-RM. November 1993. DEC.
- VT520/VT525 Video Terminal Programmer Information. EK-VT520-RM. July 1994. DEC.
- "Hardware Dependent". SCO Unix System Administrators Reference. 1993-02-01. The Santa Cruz Operation. tenox.net.
- Control Functions for Coded Character Sets. ECMA-48. 5th edition. 1991. ECMA International.
- https://unix.stackexchange.com/a/289871/5132

- 68,745
-
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
terminfo
database has the set of keys and their sequences. – Chris Davies Apr 22 '18 at 06:44