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 was just ssh'd into my server (Ubuntu 10.04.2), and I ran aptitude (in interactive mode). Once I pressed one key (one of the letters, g I believe), it turned into this (not just the SSH session; this behaviour continued after I terminated the ssh session):

Term 1

Term 2

I can reconnect and everything will be okay, but when I run aptitude again, the same issue happens (but, strangely enough, is contained to within aptitude).

Does anybody have any idea what could be happening? If it helps, I'm running screen with a byobu profile, my $TERM is screen-bce, and I'm using Terminal.app on 10.6.7.

share|improve this question
    
happened several times to me as well! –  tekknolagi Oct 26 '11 at 7:14

3 Answers 3

up vote 2 down vote accepted

You could use the command reset to get your normal terminal back.

As to why this is happening - somehow, your terminal is getting binary data as opposed to ASCII.

share|improve this answer
    
This is usually the result of viewing vs. executing a binary program. cat {binary file} will often do it. –  Chris Nava Apr 9 '11 at 4:28
    
@Chris True - but I'm leaving room open to speculation because this is upon login. My guess is a .bashrc issue, but we can't be sure :) –  new123456 Apr 9 '11 at 18:47
    
So should I assume that this is because aptitude is somehow outputting binary data? * gets ready to file bug report * –  squircle Apr 10 '11 at 23:18

I realize this thread is almost a year old, but since I just encountered this problem myself after using "cat" to display the contents of an executable in Apple's Terminal.app, I figure that this situation may affect future users too.

Any way, as far as I can tell, the weird characters appear after the ASCII "shift out" character (decimal 14, 0x0E) is printed. (Well, the word "printed" might not be appropriate because, at least for Terminal.app, this is not a printable character, but I hope you know what I mean.) Fortunately, the terminal goes back to normal if the ASCII "shift in" character (decimal 15, 0x0F) is printed.

In other words, if one wrote a C program like...

#include <stdio.h>
int main() {
   printf( "\x0F" );
   return 0;
}

It should turn everything back to normal. There is probably an even easier way in a different language or within the bash shell, but hopefully you get the idea.

Apparently, this strange behavior is not a bug, but rather an obscure (to me, at least) feature. When I searched for information, I was directed to ISO 2022, which seems to be the basis for what the terminal is doing. Here is the Wikipedia article on ISO/IEC 2022.

I hope this post was helpful now that the mystery behind the strange characters is cleared up.

share|improve this answer

The menu item

Terminal > Shell > Send Reset

resets the terminal state to the defaults, including the character set, which resolves this specific issue.

share|improve this answer

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.