Display messd up with weird characters in Gentoo after `cat` a binary file

11

1

I ran cat /etc/localtime to see the contents of /etc/localtime - however it's a binary file, so my console became like this:

alt text

You may notice the red text in screenshot is "LiveCD"; commands can be executed correctly, but they display in a weird way. I'm in the middle of an installation process, so I'd prefer to avoid rebooting. How can I return my display to normal?

UPDATE: after running make menuconfig to enter a GUI and quitting, it's back to normal.

Cheng

Posted 2010-01-04T20:49:04.740

Reputation: 1 103

just a note: this problem is not tied with the Gentoo distribution, it happens on every Linux distro. this scenario is typical for non-UTF8 console outputs. – Mauro Toffanin – 2010-01-05T08:54:57.273

1The reason "make menuconfig" fixes your screen is that the program run is linked to a terminal handling library (libncurses I think?) and as part of the initialization of the program, it will reset the terminal to a known state. – hlovdal – 2010-01-04T21:19:53.820

Answers

18

yeah, you've output (probably) binary to the console, and its faffed up the mapping.

In situations like this, the command you want is reset.

hit return (so you know you have a blank line), type in reset and hit return again. :-D

BuildTheRobots

Posted 2010-01-04T20:49:04.740

Reputation: 316

7

An alternative to the reset command is to output the ASCII SI (shift in) character, decimal value 15. This can be entered with Ctrl-O, and should work on any (even ancient) unix in case it laks the reset command.

prompt>
prompt>echo ^V^O

hlovdal

Posted 2010-01-04T20:49:04.740

Reputation: 2 760

This worked for me whereas reset did not – sync – 2012-12-12T01:57:52.270

1

Try running the reset command. If hitting return before and after the reset command doesn't work, try control-J.

Also, Alt-F2 to switch to an alternate terminal can bypass the issue temporarily.

freiheit

Posted 2010-01-04T20:49:04.740

Reputation: 360