Sometimes, a terminal screen is messed up, and when we use man ls
to read the manpages, or press the UP arrow to go to previous commands in history, the screen will show characters not as the right place. (for example, treat the end of screen as some where in the middle of the screen).
The command reset
is tried and it wouldn't work. One way that works is to log out or close the window, and resize the window first, and then do ssh
(or close that tab, and resize the window, and then open a new tab to get a new shell).
But this way, we will lose anything that we previously did, such as starting a virtual machine console, etc. So if we don't close the shell, is there a way to fix this problem?
(this happened before right inside Fedora, and also for a Macbook ssh
into a RHEL 5.4 box).
Update: I remember now how it happened in Fedora: I opened up a Terminal, and did a FreeVM to use a console of a Virtual Machine (a shell). I think it was size 80 x 25 and then after a while, I resized the Terminal to 130 x 50 approximately, and then the "inner shell" (of the VM) started to behave weird).
reset
doesn't resolve the issue.^Jreset^J
, where^J
means pressingctrl-J
. Or (on graphical terminals) you can try theReset
button. Also, some programs just aren't prepared for terminal sizes changing underneath them (yes, ancient software is alive and kicking) or just misbehave badly when the terminal gets too small.