Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does tmux set TERM=screen?

Tags:

terminal

tmux

How does tmux set the terminal to use (as reflected in the TERM environment variable).

For example. If I log in via ssh bash reports:

>set | grep TERM
TERM=xterm-256-color

If I then run tmux and from within tmux and do the same:

>set | grep TERM
TERM=screen

I think this is not always the case though since noticing it I have not managed to make tmux say anything else.

This relates to fake/mock/background terminal for testing an ncurses application

Where I am I trying to understand how the terminal emulation affects the resulting behaviour of an ncurses app.

like image 529
Bruce Adams Avatar asked Jul 18 '26 05:07

Bruce Adams


1 Answers

That's controlled by the default-terminal server option in .tmux.conf:

set -g default-terminal "screen-256color"

From the docs:

default-terminal terminal Set the default terminal for new windows created in this session - the default value of the TERM environment variable. For tmux to work correctly, this must be set to ‘screen’, ‘tmux’ or a derivative of them.

It is considered good practice to not touch the TERM variable directly (do not set it manually in .bashrc or .zshrc but instead rely on tmux to generate it from .tmux.conf).

like image 162
Mihai Galos Avatar answered Jul 19 '26 20:07

Mihai Galos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!