PuTTY: connected to some Ubuntu server, sometimes stops going to a new line when pressing enter
I use PuTTY in order to SSH to some Ubuntu 14.04.4 LTS x64 server. Pressing the key ENTER causes the terminal to go to a new line. However, from time to time, some program outputs some text, and afterward pressing the key ENTER doesn't causes the terminal to go to a new line anymore (see demonstration below).
Is there any way to prevent that, or at least when pressing the key ENTER doesn't causes the terminal to go to a new line anymore, is there anyway to reset the terminal so that ENTER causes the terminal to go to a new line again?
You can use the reset command by typing in reset
then pressing Enter
when that occurs to reset the terminal so it'll go to a new line when pressing Enter
again.
Command
ubuntu@db200krctc:~$ ubuntu@db200krctc:~$ ubuntu@db200krctc:~$ ubuntu@db200krctc:~$
ubuntu@db200krctc:~$ reset
ubuntu@db200krctc:~$
ubuntu@db200krctc:~$
ubuntu@db200krctc:~$
Further Resources
-
reset
When invoked as reset, tset sets cooked and echo modes, turns off cbreak and raw modes, turns on newline translation and resets any unset special characters to their default values before doing the terminal initialization described above. This is useful after a program dies leaving a terminal in an abnormal state.
The reset
command does more than you really need here in this particular case, as your problem is merely that echo has been turned off. reset
actually emits control sequences to reset the terminal itself, when all that you actually need is to reconfigure the line discipline within the operating system kernel, turning echo mode back on, and not touch the terminal at all.
For that, simply use:
stty saneor even just:
stty echo
reset
addresses situations when it is actually the terminal's own state that needs resetting and not (just) the state of the line discipline; i.e. the tabstops have been erased, the terminal is left switched to the alternative screen buffer, an inconvenient 8-bit character set has been swapped in, and so forth.
Further reading
- https://superuser.com/a/712668/38062
- https://stackoverflow.com/a/39302351/340790
- https://unix.stackexchange.com/questions/117981/