Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .