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).

  • The correct terminfo types for PuTTY are putty and putty-256color. – JdeBP Jan 23 '18 at 6: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. – 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

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.

  • infocmp xterm-256color putty-256color will tell you that there are a lot more differences than that. – JdeBP Jan 23 '18 at 6: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 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

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.