How do I restore input echoing in the terminal?

Sometimes when a script gets killed at a password prompt, I can no longer see my input being echoed in the terminal. That is, normally at a terminal, I see this:

$ _
<after typing 'foobar':>
$ foobar_

But in this case, I don't see what I've typed.

I know that I can restart the terminal to get its regular settings back, but is there a way to restore input echo without a restart?


For bash I usually just type reset and it fixes anything that was left "funny." Looks like it's also known as tset but invoking each one does something a little different.

tset, reset - terminal initialization

   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.  Note, you may have to type

       <LF>reset<LF>

   (the  line-feed character is normally control-J) to get the terminal to
   work, as carriage-return may no longer  work  in  the  abnormal  state.
   Also, the terminal will often not echo the command.

Use the stty command. Specifically, run this command:

stty echo

This will restore echo (printing input characters), which probably was turned off during the password prompt.

To see all your terminal settings, run stty -a. While the input was hidden, that should show -echo somewhere in the output. After the fix, it should instead show echo in its place.