From time to time I have to run a command-line tool (a Python script) whose output seems to break my terminal.
After the execution is finished, the typing feedback is gone (I can't see what I'm typing), and also line breaks are not displayed. This happens if the terminal is started remotely via Putty
, and also locally when using gnome-terminal
.
For example, after the problem happens, if I type ENTER pwd
ENTER, I would expect to see:
[userA@host006 ~]$
[userA@host006 ~]$ pwd
/home/userA
[userA@host006 ~]$
But actually the output is:
[userA@host006 ~]$ [userA@host006 ~]$ /home/userA
[userA@host006 ~]$
The only way to fix it is to close that terminal and start a new one.
Maybe be related: the script output contains some terminal-based formatting (e.g. invert foreground/background to highlight some status messages). If I dump this output to a file I can see things like [07mSome Message Here[0m
.
Any ideas what I could do to prevent this?
stty sane
, which restores your terminal to 'sane' settings. – Dyunreset
orstty sane
. – Fling