Is there a way to set different $TERM for different terminal emulators. For example if I am in xterm the $TERM will read xterm-256color, in urxvt urxvt-256color, in sakura xterm-256color and in tmux screen-256color.


There is no general method. As observed by vinc17, different terminal emulators let you configure the TERM value in different ways, if at all.

You can drop terminfo configuration files into your home directory, organized as ~/.terminfo/INITIAL-LETTER/VALUE. For example, if you wish for xterm to point to the 256-color entry, on a typical machine, you could do

mkdir -p ~/.terminfo/x
ln -s /usr/share/terminfo/x/xterm-256color ~/.terminfo/x/xterm

You can do this in your terminal configuration. For instance, with Xterm, this can be done via the X resources. You can do this via the Xterm app-defaults:

*termName: xterm-256color

or via a -tn xterm-256color option. This is similar for rxvt.

  • is there a universal file for this job. someone told my about alias. but I could figure that out?
    – r004
    Oct 5 '14 at 13:36
  • @r004 There is no universal file. Worse than that, each terminal has its own method to configure $TERM, and I've already seen terminals where the possible $TERM values were hardcoded.
    – vinc17
    Oct 5 '14 at 15:52

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.