# env TERM=xterm-256color



## balanga (Mar 27, 2021)

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

/.cshrc or /.profile

/.profile already contains

*TERM=${TERM:-xterm}*

How do I amend that?


----------



## T-Daemon (Mar 27, 2021)

balanga said:


> How do I globally set TERM=xterm-256color?
> 
> /.cshrc or /.profile


Depends on the shell. Which login shell are you using?


----------



## balanga (Mar 27, 2021)

Whatever is the default....


----------



## Minbari (Mar 27, 2021)

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.

```
case "$TERM" in
    'xterm') TERM=xterm-256color;;
    'urxvt') TERM=rxvt-unicode-256color;;
    'Eterm') TERM=Eterm-256color;;
esac
```


----------



## T-Daemon (Mar 27, 2021)

balanga said:


> Whatever is the default....


Users added with adduser(8) have /bin/sh as default. To make sure run `echo $SHELL`.

If it's sh(1), for globally setting (system wide): `export TERM=xterm-256color` in /etc/profile.

In case it's csh(1): `setenv TERM xterm-256color` in /etc/csh.cshrc

EDIT: Corrected typo: xterm-256colors -> xterm-256color


----------



## Mjölnir (Mar 27, 2021)

Edit login.conf(5), then `cap_mkdb /etc/login.conf`


----------



## First_Law_of_Unix (May 20, 2022)

T-Daemon said:


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


----------



## getopt (May 20, 2022)

First_Law_of_Unix
Typo. It should be xterm-256*color* not "colors"


----------



## cy@ (May 20, 2022)

```
eval `tset -Q -s -m xterm:xterm-256color`
```


----------



## grahamperrin@ (May 28, 2022)

```
% 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
%
```


----------



## Vull (May 28, 2022)

~/.shrc

```
export TERM=xterm-256color
```


----------



## _al (May 28, 2022)

balanga said:


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


Globally ?
In /etc/ttys (if you have root access):

```
ttyv0    "/usr/libexec/getty Pc"        xterm-256color    onifexists secure
```

Suppose, you are using bash and then in your .bashrc:

```
alias ls='ls --color'
```


----------

