env TERM=xterm-256color

How do I globally set TERM=xterm-256color?

/.cshrc or /.profile

/.profile already contains

TERM=${TERM:-xterm}

How do I amend that?
 
Do you use .Xresources to config xterm? You can define him there. ( XTerm.termName: xterm-256color), or add the following lines in your .(shell)rc file:
e.g.
Code:
case "$TERM" in
    'xterm') TERM=xterm-256color;;
    'urxvt') TERM=rxvt-unicode-256color;;
    'Eterm') TERM=Eterm-256color;;
esac
 
In case it's csh(1): setenv TERM xterm-256colors in /etc/csh.cshrc

I tried this and terminal just wasn't working properly any more. Kept giving "tput" error commands whenever I typed something on terminal. I had to remove that code and then reboot and terminal was working properly again. Also I am using headless FreeBSD which has the default "csh" shell.
 
Code:
% echo $0
/bin/tcsh
% bash
[grahamperrin@mowa219-gjp4-8570p-freebsd ~]$ eval `tset -Q -s -m xterm:xterm-256color`
bash: setenv: command not found
[grahamperrin@mowa219-gjp4-8570p-freebsd ~]$ echo $0
bash
[grahamperrin@mowa219-gjp4-8570p-freebsd ~]$ echo $SHELL
/bin/tcsh
[grahamperrin@mowa219-gjp4-8570p-freebsd ~]$ exit
exit
%
 
How do I globally set TERM=xterm-256color?
Globally ?
In /etc/ttys (if you have root access):
Code:
ttyv0    "/usr/libexec/getty Pc"        xterm-256color    onifexists secure

Suppose, you are using bash and then in your .bashrc:
Code:
alias ls='ls --color'

color_xterm.png
 
I have just installed 14.0-R on a fresh partition and am getting different values for $TERM....

When logging in via ssh I have, TERM=xterm-256color, but logging in locally, I have TERM=xterm.

Can someone explain why I get different values, and how they get set?
 
TERM travels with ssh, it's otherwise set in various ways (some mentioned in this thread) when you log in locally. TERM is the sort of variable that terminal emulators try their best to set appropriately and software tries its best to pass along so that the environment is set to the correct sort of TERM for the actual terminal type you are physically using. Setting a terminal to something that it's not (for example, setting a strictly vt100 compliant terminal to be an xterm-256color) could make the display go funky and not work as expected.

To have it set absolutely to the same thing for all your single user logins it's probably easiest just to put into your shell's rc file and override an already set TERM, but depending on the terminal emulator you are using you may experience issues (though to be honest, these days there is a good chance that you will always be on an xterm compliant terminal, so in the end may not matter)
 
Back
Top