现象:vi /etc/profile
而且退出后,下图终端的空白部分, 就无法使用了。这个是terminal的问题
解决方法如下:将下面内容 添加到 /etc/profile 即可
res() {
old=$(stty -g)
stty raw -echo min 0 time 5
printf '\0337\033[r\033[999;999H\033[6n\0338' > /dev/tty
IFS='[;R' read -r _ rows cols _ < /dev/tty
stty "$old"
# echo "cols:$cols"
# echo "rows:$rows"
stty cols "$cols" rows "$rows"
}
export TERM=xterm
[ $(tty) = /dev/ttyS0 ] && res
再次打开效果如下:完美解决。
ref: resizable serial console window? - Unix & Linux Stack Exchange