Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reset my terminal in a GNU screen session after accidentally printing binary garbage?

Sometimes I accidentally print binary garbage on the screen, for example I have printed a binary hash value or nonce instead of the hex hash value.

Sometimes the terminal is messed up in various ways after this, because the binary data contained escape sequences which reconfigure the terminal, rendering it almost useless.

When in a normal shell (locally or via ssh) it is usually sufficient to blindly type reset and press enter. (Often the typing is not visible due to the messed up terminal configuration.)

But when in a shell which is inside a GNU screen session this is sometimes not sufficient and the shell is still unresponsive.

How can I revive my terminal without destroying it and re-creating it?

like image 425
Johannes Overmann Avatar asked Oct 21 '25 20:10

Johannes Overmann


1 Answers

The GNU screen terminals maintain part of the terminal state, too. To reset that in GNU screen do:

  • Press Ctrl-A.
  • Enter :reset and press enter.

Done. You may also need to enter reset in the terminal itself as well as usual.

like image 119
Johannes Overmann Avatar answered Oct 24 '25 23:10

Johannes Overmann