Setting TERM in .bashrc and using tmux

A project log for Handheld Linux Terminal [HaLiTerm]

A compact serial terminal with a built-in NanoPi Neo Air running DietPi.

balazsBalazs 08/26/2023 at 12:010 Comments

Setting the TERM variable or the terminal size in .bashrc leads to some issues in tmux. By default, TERM is "vt220" in DietPi while using UART. This is a possible workaround that can be added to .bashrc:

if [ $TERM = vt220 ]; then
    stty cols 100 rows 30

This way TERM doesn't change if it was set by tmux (in my case it is "tmux-color256"). This can also be used to add lines that shouldn't be executed every time you open a new window in tmux.