Newsgroups: comp.os.linux.misc
>Whist working in a vga bash shell I accidentally "more"d a binary file >(I think it was boot.map). For some reason this caused the screen font >for that shell to become corrupted. I could still type, and the >commands were recognised, but the font just showed non-ascii characters.
That is one way to corrupt a terminal, but there are others too! And there are several ways to correct it, as the multiple responses to your post all indicate. However, there are some things you can set up to make recovery easier.
Put this into your ~/.bashrc file:
alias sane='echo -e "\\033c";tput is2;stty sane line 1 rows $LINES columns $COLUMNS'
Then you have two options. You can type "reset", which sometimes works, or you can type "sane" which will always work.
Floyd L. Davidson
> Then you have two options. You can type "reset", which > sometimes works,
Sometimes you have to do it twice. No idea why.
> alias sane='echo -e "\\033c";tput is2;stty sane line 1 rows $LINES columns $COLUMNS'
What has happened is "you" told the terminal to switch to the ansi "alternate character set", which is for line drawing and other special things. The control-N character (^N, 14, octal 016, SO = shift out) switches to the alternate character set, and control-O (^O, 15, octal 017, SI = shift in) switches back to normal, on an ansii-compatible terminal.
It is the "echo <escape>c" in the above that resets the text because <escape>c is the code for "reset to initial state". This is a powerful restoration, but it may do too much, like erasing the scrollback. Instead you can get back to an ordinary character set with 'echo -e "\\017"'.
Before doing anything, you should press control-U to erase any garbage in your input buffer. Then you can directly type
echo ^V^O <return>
or use a defined alias
alias earthling='echo -e "\\017"' alias martian='echo -e "\\016"'
and type "earthling". Finally, you can probably just press
^V^O<return>
The shell will helpfully echo the separate characters ^ and O, but you will get an error message about an undefined command, and writing a real control-O
(By the way, in the shell, ^V (control-V) means to take the next character "verbatim".)
Donald Arseneau