Reputation: 113
Once in a while I'll be working on things and suddenly my console's alignment gets completely messed up. I think it's usually after a command fails or crashes (though I haven't been able to pin down a specific command that causes it). It looks looks like \r
is no longer being output or read correctly or the terminal has some non-interactive mode flag set.
I'm running ZSH with OMZ inside of tmux inside of iterm2.
Upvotes: -1
Views: 84
Reputation: 1036
This misalignment can be caused by various reasons, including a command messing with the terminal settings and being killed before it can restore them on exit, or by a command outputting unexpected control sequences.
You can easily reproduce these conditions by:
cat
or similar commands like head
or tail
on binary files.screen
or less
.Fortunately, there are programs that can reset terminal settings back to normal:
clear
or, in most shells, press Ctrl-L
. This will clear the screen but keep the scrollback buffer.resize
command.stty sane
will reset most of the crucial terminal settings while keeping the screen content and scrollback buffer intact.reset
, which is usually an alias or link to tput reset
. This will restore the terminal to a sane mode, resetting most of the crucial capabilities, including clearing the scrollback buffer.exec $SHELL -l
after resetting the terminal can help.Upvotes: 1