-2

By default, Putty identifies itself as "xterm" terminal type, but it's possible to change its settings so it identifies itself as "xterm-256colors".

As far as I understand, this is done by setting "$TERM" variable.

The problem is that this requires every individual user to change their Putty configurations one by one.

To eliminate that, I am considering forcing every user to have "xterm-256colors" $TERM value centrally (e.g. via .login).

Assuming that every user uses a terminal program which supports "xterm-256colors", is there any difference whatsoever between doing this from the Unix side directly instead of from the terminal program? (I'm mostly looking for possible issues/downsides).

DVK
  • 311
  • 2
  • 12
  • The correct terminfo types for PuTTY are [`putty`](http://invisible-island.net/ncurses/terminfo.ti.html#tic-putty) and [`putty-256color`](http://invisible-island.net/ncurses/terminfo.ti.html#tic-putty-256color). – JdeBP Jan 23 '18 at 06:48
  • @JdeBP - I'm trying to ensure people in XTerm and Putty have same experience/colors, so setting TERM to "xterm*" seems a better option – DVK Jan 23 '18 at 10:27
  • 1
    That is quite wrong. To give them the same experience, you have to tell applications programs _the correct information about the terminals they are talking to_, which involves telling them different information about the two [_different_ terminal emulators](http://invisible-island.net/xterm/xterm.faq.html#other_versions-id). – JdeBP Jan 23 '18 at 11:11
  • @JdeBP - the assumption was that Putty emulates xTerm functionality. Perhaps incorrect – DVK Jan 23 '18 at 13:25

1 Answers1

1

There is no difference between setting the value explicitly or letting the terminal program set the value; both result in the TERM variable getting set. That said, letting the terminal program set the value is the best way to get a sane setting – the terminal knows the terminal type it supports. If the terminal doesn't support the specified terminal type, then it's hard to predict what the output will look like when rendered by the terminal.

As @JdeBP points out in the comments, the values used by putty and xterm differ; it is not safe to assume that everything will support xterm-256.

Andy Dalton
  • 13,654
  • 1
  • 25
  • 45
  • `infocmp xterm-256color putty-256color` will tell you that there are a lot more differences than that. – JdeBP Jan 23 '18 at 06:53
  • Note that I was addressing the question of "is there a difference between setting TERM directly instead of from the terminal program" and not addresses any differences between specific terminal types. – Andy Dalton Jan 23 '18 at 15:00
  • By claiming that the main difference will be that colour control sequences will display as "garbage". Ironically, _that_ won't really happen, and one of the _actual_ main differences is in fact something that turned up within hours of this very answer at https://unix.stackexchange.com/questions/419068/ , as revealed by `infocmp` as I said. – JdeBP Jan 23 '18 at 19:16
  • @JdeBP You're right, that portion of my answer was wrong/misleading -- thank you. I've updated my answer to try to make it more correct. – Andy Dalton Jan 23 '18 at 19:44