Thursday, December 11, 2008

Fix a broken terminal

To fix a broken terminal, try one of these commands:
tput init
tput reset
reset
[ENTER] reset [ENTER]


If binary characters are sent to a terminal, it will often leave the screen in an abnormal state because it interprets them as control characters. A random stream of control characters can make the terminal unreadable. You may not be able to see the commands as you type them until the terminal is reset, or you may see junk characters as you type. Often, though, one of the above commands will clear up the problem.

To see the device of the current terminal:
tty

Pseudo-terminals under OS X Aqua are usually /dev/ttyp?. For example, /dev/ttyp1, /dev/ttyp2, etc.

To see all current terminal settings:
stty -a