I telnet to an HP switch from my (xterm|gnome-terminal). Exit telnet. That breaks the behaviour of the terminal. (If you don't have a HP switch to telnet to, one can cat this file in a terminal instead).

Now type a very long command (more than one line, and see that the second line doesn't wrap down to the next line, but "stays in the current line". Which makes it impossible to edit prior commands or use the terminal for anything longer than one line.

See that cat filewithlonglines.txt or git log -p only shows the first 80 chars of lines longer than 80 chars.

reset doesn't work. stty -g > stty.works, run telnet, stty $(stty.works) restores changed stty settings, but behaviour is still broken.

I have to close the terminal and start a new one. :-(

What can I do besides reset and stty save/restore to fix my broken terminals after a telnet?

link|improve this question
feedback

1 Answer

Besides reset there are a few other things I always try. And sometimes it helps restoring terminal sanity:

  1. resize (on some systems it's not in $PATH, usually found in something like /usr/X11/bin/)
  2. echo "^v^o" (press CTRL+V and afterwards CTRL+O, this is an old Unix trick that has helped my very often after I inadvertently did cat on a binary file.)
  3. stty sane
link|improve this answer
1  
Humorous note: stty cooked is an alias for stty sane. – Paidhi Oct 21 '11 at 7:45
I just tried these, and my terminal is still broken. I note that 'echo "^v^o"' Is never seen in the terminal. I pressed e+c+h+o+<space>+CTRL-V+CTRL-O+<ENTER>, right? That printed echo ^O in my terminal. – Peter V. Mørch Oct 26 '11 at 9:48
That's right. I think the quotation (") is optional. This often helped me with a broken terminal shell session. Especiallay when connected to HP-UX systems. – Paidhi Oct 30 '11 at 10:14
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.