Ubuntu – Does the Terminal keep showing “^[[2~” randomly

18.04command linegnome-terminalsamsungusb-installation

I just installed 18.04.1 and when I am using the Terminal (only there), it keeps showing ^[[2~^[[2~^[[2~ at random times, even when I am neither pressing any key at all on my keyboard nor even touching the trackpad. On average, I would say I get 5 lines full of that input in 20 seconds (although sometimes I can be around 2 minutes without that problem).

The only relevant post I have found so far is the one titled Why the terminal shows “^[[A” “^[[B” “^[[C” “^[[D” when pressing the arrow keys in Ubuntu?. If the arrows are responsible for those symbols, which key is responsible for ^[[2 ?

Main question: What is causing the problem, and how can I solve it? In case it is relevant, I am adding some details below.

Installation: I downloaded the ISO of 18.04.1-LTS while using the 17.04, and I used the Ubuntu tool for creating a bootable USB. Then I installed 18.04.1 on my Samsung 535U using the USB I created. I chose the install option that deleted all the files and all the OS's from the hard drive.

PC model: Laptop Samsung 535U shipped originally with Windows 7

When I go to "Input Method" (GUI) I always get "Number of valid choices: 2 (normally 1)"

Best Answer

With a bit of trial and error, on my system I found that the Insert is ^[[2~. You can check this in a terminal by pressing CtrlV (to turn on Verbatim mode), then pressing Insert. It's possible the key is faulty and sending in keypresses randomly. I have heard of programs which inhibit sleep by simulating keypresses (perhaps Caffeine?) so that might also be a cause.