> >/bin/echo "\033c"
> >echo <Ctrl-V><Esc>c
> Both of these methods worked for me. Thanks. Now, the next time my
> screen freaks out and I use these key combinations to reset it,
> someone will ask me "what does that do?". How can I explain what is
> happening when I do this?
A terminal (physical or emulated) understands "Control signals". These
control signals are usually implemented in terms of Escape
Sequences. When you write these Escape sequences to a terminal, they
are not written to the screen, but the terminal driver takes special
actions for these sequences. In fact, we use most of these sequences
everyday, but don't notice it. For e.g., when you use vi, and say go
one line up, the whole screen is not written (it would be too slow),
but a special "escape sequence" is sent which asks the driver to move
the cursor to the specific location.
Here, "Esc c" is the sequence to reset a terminal. It is fairly
portable among different terminals (vt100, xterm...). To write the
"esc" character, we need to prefix it with <Ctrl-V>, so that the <esc>
character is taken literally.
So echo <Ctrl-V><Esc>c works.
The octal code for Esc is 033, so in principle echo "\033c" also
works, but some inbuilt echo programs (like in bash) do not honour the
backslashed things like \033 unless you give the option -e.
So, I wrote /bin/echo "\033c" instead of only echo "\033c" so that the
binary in /bin will be executed instead of the shell built-in.
Regards,
Lokesh.
--
When we come back, I'll drop a line. (The Doors)