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.

Some times my Unix terminal gets destroyed, either by:

  • I can type commands, but characters are not echoed on the screen. When I press enter, the prompt is printed on the same line as the current one (newline is not inserted first)

  • If I accidentally do cat on a binary file, then the charset is changed so that commands I type are shown as garble rather than normal ascii.

Is there any fix-all-way to restore the shell back to normal, or do I just have to close the terminal and start a new one?

(I am on Mac with Bash at the moment, but I've had this on other systems too.)

share|improve this question

2 Answers 2

Type :

kill -28 $$

or

reset

that should restore your term =)

Note

28 is SIGWINCH signal, see

man 7 signal
share|improve this answer

The standard way to unwedge a tty is to type: ^Jreset^J (here ^J is control-J). This sends a newline to finish any line (first ^J), the command reset and another newline. If whatever is listening is a shell, this should fix things. Sometimes (rarely) replacing the command with stty sane is required. If you know what might be running behind it, perhaps sending whatever command makes that quit is needed beforehand.

share|improve this answer

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.