Take the 2-minute tour ×

When I run a particular program on my server using putty and I hit ctrl+c to stop it, my stdin stops echoing back to me at the command line.
So for example, after running the program and stopping it, if I type ls I cannot see the characters ls, but I can see the directory listing.
What is going wrong?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

stty sane

Probably the program sets some terminal settings (see man stty) and when you interrupt it with Ctrl+C the program does not catch the interrupt and clean up (i.e restore to normal) the terminal settings but just exits. It may be just the stty echo (echo input characters) setting that needs resetting, but it is probably others too.

Just use the command stty sane to restore sanity to your terminal settings.

Alternatively you should be able to use stty -g > settings.sttyto save current terminal settings before running your program. After interrupting the program, use stty `cat settings.stty` to restore those specific settings. Try stty sanefirst, it should do all you need.

share|improve this answer
add comment

Your Answer


