Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do my keystrokes turn into crazy characters after I dump a bunch of binary data into my terminal?

Tags:

If I do something like:

$ cat /bin/ls

into my terminal, I understand why I see a bunch of binary data, representing the ls executable. But afterwards, when I get my prompt back, my own keystrokes look crazy. I type "a" and I get a weird diagonal line. I type "b" and I get a degree symbol.

Why does this happen?

like image 226
raldi Avatar asked Sep 23 '08 14:09

raldi


People also ask

How do I reset the console in Linux?

To Reset and Clear your Terminal: Press the menu button in the top-right corner of the window and select Advanced ▸ Reset and Clear.

How do you exit a binary file in Linux?

Hit Control + C a couple of times ( Ctrl + C ) Type the command reset and hit return.

What is special character in Linux?

The characters <, >, |, and & are four examples of special characters that have particular meanings to the shell. The wildcards we saw earlier in this chapter (*, ?, and [...]) are also special characters.

Which character does bash use to ignore all input that follows it?

Use quote marks to tell the Bash shell to ignore all special characters, of which a white space is a special character.


2 Answers

Because somewhere in your binary data were some control sequences that your terminal interpreted as requests to, for example, change the character set used to draw. You can restore everything to normal like so:

reset
like image 139
Nick Johnson Avatar answered Oct 03 '22 21:10

Nick Johnson


Just do a copy-paste:

echo -e '\017'

to your bash and characters will return to normal. If you don't run bash, try the following keystrokes:

<Ctrl-V><Ctrl-O><Enter>

and hopefully your terminal's status will return to normal when it complains that it can't find either a <Ctrl-V><Ctrl-O> or a <Ctrl-O> command to run.

<Ctrl-N>, or character 14 —when sent to your terminal— orders to switch to a special graphics mode, where letters and numbers are replaced with symbols. <Ctrl-O>, or character 15, restores things back to normal.

like image 25
tzot Avatar answered Oct 03 '22 21:10

tzot