Как восстановить входной эхо-сигнал в терминале?

4271
congusbongus

Иногда, когда сценарий убивается при запросе пароля, я больше не вижу, что мой ввод отображается в терминале. То есть обычно в терминале я вижу это:

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

Но в этом случае я не вижу, что я напечатал.

Я знаю, что могу перезагрузить терминал, чтобы восстановить его обычные настройки, но есть ли способ восстановить входной эхо без перезагрузки?

7

2 ответа на вопрос

12
Xen2050

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. 
2
congusbongus

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.