Clean up ncurses mess in terminal after a crash

Dilawar picture Dilawar · Aug 1, 2012 · Viewed 11k times · Source

I am drawing a TUI using ncurses. The trouble is that whenever my program gets seg-fault, my terminal is left in mess. I can not see what I am typing. Its a pain since I am working over ssh. I have mitigated some of the effect by using screen.

I would like to know if there is a command which will refresh my terminal after seg-fault in ncurses so that my terminal starts behaving normally.

Answer

Dilawar picture Dilawar · Aug 1, 2012

Command,

stty sane^J

did the job.

UPDATE: On some terminals stty sane also works.