Reset Command After A Broken NCurses Session

Probably everyone but me who uses the shell knows this secret but just in case I’m not alone I thought I’d share the following wisdom: Quite often I use ncurses based programs such as htop over an ssh session in a shell. And every now and then, the session is interrupted due to some network problem or remote reboot. This means that the shell returns to the prompt but the ncruses mode is still active. In other words, no cursor and strange characters popping up when special keys are pressed or the mouse is moved over the window. So how does one get back into the normal ‘shell’ mode? Turns out the answer is quite straight forward:

$ reset

… is all it takes to clear the screen, get the cursor back and disable ncurses.

Kudos to wmcbrine who mentioned this in a comment to a question back in 2009 over here.