Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 1

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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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