I love the "It's harmless with a terminal emulator". I (obviously) get what they're saying, but you'd think making millions of people waste 3 seconds of their lives every time would be considered at least a modicum of harm.
Back in the day, when the screen/terminal was borked, due to <i>cat</i>ting a binary or other reasons, we used to do;<p><pre><code> stty sane Ctrl-J
</code></pre>
or other variants. It mostly worked. Last resort was to switch the terminal off and on, and/or to kill the login shell from another terminal, IIRC.<p>See: man stty
To workaround it add the following to your shell's rc file:<p>function reset { printf '\e]\e\\\ec' }<p>Uses the VT100 RIS escape code to ask the terminal to reset itself. But first it send an empty OSC escape to reset the terminals VT parser back to normal mode, so that the RIS escape code is parsed correctly. No need to depend on any external utilities like tput or the reset binary. This should work with any halfway decent terminal emulator.
>and since there's no conventional way to tell the difference (and too hard to determine if some escape sequence might do a hardware-reset), reset assumes your terminal is real.<p>The TERM environmental variable can be used