19

Citing tmux man page:

The TERM environment variable must be set to “screen” for all programs running inside tmux. New windows will automatically have “TERM=screen” added to their environment, but care must be taken not to reset this in shell start-up files.

Is this this because tmux session can be attached to any terminal (e.g. remote), screen being lowest common denominator? If I know my terminal, can I force it without unexpected results, or would some unsupported capabilities break (like scrolling)?

13

It does this to take advantage of the previously-installed terminal description for GNU screen.

Both tmux and screen provide applications with (more or less) the "same" terminal descriptions to simplify connecting from different terminals. The tmux and screen programs are supposed to handle the differences between the internal (TERM=screen) and external (xterm, linux, etc). So the screen terminal description has been installed "everywhere" (usually by ncurses).

There are some differences:

  • GNU screen has a very old problem representing the "standout" feature (which technically is not a specific terminal feature but rather an abstraction for the convenience of curses applications). tmux does not have that limitation. But the improved TERM=tmux is not necessarily "everywhere".
  • GNU screen has a feature for using hybrid terminal descriptions. Given the external TERM=xterm and the existence of "screen.xterm", it will choose that for the internal TERM value. (see for example the terminal database). tmux does not do that.
5

As of tmux 2.1, you can use the tmux terminfo:

'default-terminal' is now a session option. Furthermore, if this is set to 'screen-*' then emulate what screen does. If italics are wanted, this can be set to 'tmux' but this is still new and not necessarily supported on all platforms with older ncurses installs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.