Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been programming on Windows for a few years, and there has been an issue that is becoming increasingly frustrating as I have really started to use various terminals in Windows for my development purposes. To login to remote machines, I use PuTTy, and I recently discovered Cygwin, which I have found to be a really great shell. I also have a MacBook Pro and I use Terminal a bit as well.

What I have noticed is that without me typing anything, 8~ will type itself into my terminal, and if I leave the computer for 10 or 15 minutes, I will regularly see something like:

8~8~8~8~8~8~8~8~8~

In addition, when I am in emacs, I notice that numbers will randomly appear without having typed them such as 012, or 34, etc. This has happened to me on a variety of different Windows machines, and I have tried probably hundreds of different Google searches to try and ascertain why this is occuring, and I have had absolutely no luck in finding out what is causing this.

I would really appreciate any help in this. I know this isn't really a programming question per se, but I assumed Stack Overflow wouldn't appreciate this question and since you are all programmers, I figure that one of you would have some insight.

Thanks very much.

EDIT: I originally posted this on www.programmers.stackexchange.com and I got three comments asking me for clarification, so I am reposting the question with the asked clarification.

  1. It's almost certainly some form of keepalive, but the context isn't quite clear. You're on Windows, using PuTTy, and connecting to emacs on another machine, and getting random characters? What have you tried to isolate it? Do they show up if you just open a window and not connect? If you just open a console window?

It happens when I just use emacs/Cygwin locally, and it also happens when I use emacs via puTTy when logging into my school's linux server. I don't really know what I can do to isolate it, I don't even know the cause! It never happens on mac, either locally or when I log into the same server, so I assume the issue must be local. Since it happens when I log into my school server either through Cygwin or putty, as well as when I am just using Cygwin with emacs locally, it must be something with Windows.

  1. Does this happen only from Windows or also from the Mac? Does it happen only when you're logging in to a particular machine, or to others as well? If it's only to a particular machine, what OS is it running (what distribution, what version)? Is this correlated with moving the mouse? Your question is off-topic here, but if you add the information we've requested, you could repost it on Super User.

No it does not happen in the Mac locally or when I log into the school server. It happens to me with Windows 8 Pro and Windows 7 Ultimate.

share|improve this question
    
The shell eats part of the sequence and displays only half of it. Could you run cat on a terminal, wait for the garbage to appear, then copy it here? (It will look something like ^[8~ or ^[[8~ or similar.) I think it will be easy to answer what the characters mean, even if I don't know why they're sent. –  grawity Aug 8 '13 at 21:49
    
Yes!!!! ^[[2~ and ^[[8~ both have appeared before. What is it?? I'll run what you ask though. omg –  Arthur Collé Aug 8 '13 at 21:51

2 Answers 2

Sometimes, seemingly "random" characters can appear in terminals or some Linux programs in Cygwin/SSH because you've typed a keyboard key that isn't mapped on the machine. A big culprit of this would be macro or multimedia keys on extended keyboards, or (in rarer circumstances) if you have a Fn key on your keyboard that you need to use for certain keystrokes. These keys may be unmapped by the OS you're controlling and so may appear in terminals or other places where text can be typed as the raw keyboard code/character that the keyboard sends to the OS to be interpreted. It's the same reason why Conrol+C will appear in terminals as ^C, for instance.

What might be happening is that you hit a key combination or pressed a key on your keyboard that isn't mapped by Linux on that particular machine, and ended up getting typed into your terminal or text editor. Or, there could be a regular event set up on the computer that triggers the keypress automatically and causes it to appear.

You didn't specify if it happens when you type something or even if you're not. But in my experience, this is why you might see this occur.

UPDATE:

Through some trial and error messing around with Cygwin, I discovered what the 8~ is associated with.

It appears when you type the key combination Ctrl + Alt + Shift + Del. I don't know why it appears so often, but something on your computer is apparently triggering that input. It could be some software running in the background or perhaps a faulty keyboard.

You can try verifying this yourself. I'd first try a different keyboard and, if that doesn't help, start going through your running processes and use process of elimination to try and isolate which one it is.

share|improve this answer
    
It occurs both while I'm typing (which is most annoying because then I'll only catch it if I'm typing a command in the terminal, or when I'm compiling -_-) and when I am not typing. –  Arthur Collé Aug 8 '13 at 21:50
    
@Windows I am updating the answer with more info. –  Ben Richards Aug 9 '13 at 17:15

On Unix-like operating systems, programs use various terminal features (colors, cursor movement, etc.) by sending escape sequences to the terminal. The terminal itself sends escape sequences to programs when you press various special keys, or (if the program has enabled it) use the mouse within the terminal window, or in response to certain queries.

These sequences always start with an ESC byte, which in various places may appear as ^[ (which actually means Ctrl [, but it's the same byte because of how ASCII works), so ^[[2~ is actually ESC, [, 2, ~.

(The bash shell runs in "raw" mode and interprets some keypress sequences, such as arrow keys. When it does not recognize the sequence being input, it discards the part it saw, and continues interpreting the remaining part as regular keypresses – that's why half of the sequence, such as the ~, end up inserted in the command line. On the other hand, when you run cat or are compiling something, everything that you input is displayed in full by the terminal itself, so you can see the full "undamaged" sequences. That's why I asked you to run cat.)

Frequently, sequences that represent key presses end with a ~. Out of the two you mentioned in your comment, ESC [ 2 ~, corresponds to the Insert key. The other one (ESC [ 8 ~) I can't find even in PuTTY's source code [yet]. So I'm not sure if you remembered the codes correctly.

share|improve this answer
    
"8~" by itself appears literally every 5 minutes. I've left the terminal open with cat entered for 10 minutes and nothing has appeared so far –  Arthur Collé Aug 8 '13 at 22:29
    
oi41.tinypic.com/29or8ro.jpg –  Arthur Collé Aug 8 '13 at 22:40
    
Sorry if the above link violates TOS with my personal information but I really don't care if people know my first name. I just wanted you to see an example. For some reason I am not getting the (not)"random" inputs when I type cat, I've left the shell for 17 minutes now and I am not getting anything –  Arthur Collé Aug 8 '13 at 22:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.