Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Where is default $TERM set?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
PhoenixStarEclipse
n00b
n00b


Joined: 11 May 2017
Posts: 64
Location: Jiangsu/China

PostPosted: Sun Aug 19, 2018 5:09 pm    Post subject: [Solved] Where is default $TERM set? Reply with quote

In recent linux systems, xterm has 256color support, so xterm-256color doesn't have to appear. However, my $TERM happens to be xterm-256color. I've checked .bashrc and /etc/bashrc, but found nothing about $TERM. I'm just curious where it was initially set.

I don't tend to change /etc/bash/bashrc, since it should only affect interactive shells, while I'd like it to affect everything.

Thanks for your time :D.
_________________
Think twice,code once.


Last edited by PhoenixStarEclipse on Wed Aug 22, 2018 8:27 am; edited 1 time in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Mon Aug 20, 2018 8:52 am    Post subject: Re: Where is default $TERM set? Reply with quote

PhoenixStarEclipse wrote:
In recent linux systems, xterm has 256color support, so xterm-256color doesn't have to appear. However, my $TERM happens to be xterm-256color. I've checked .bashrc and /etc/bashrc, but found nothing about $TERM. I'm just curious where it was initially set.

PhoenixStarEclipse ... it's set/reported by the terminal, or in the case of console by inittab/agetty. So, if you run screen, or tmux, within your xterm it'll detect the term supports 256 colours and set/report 'screen-256color'. For this reason you shouldn't set TERM in .bashrc or what-have-you.

HTH & best ... khay
Back to top
View user's profile Send private message
PhoenixStarEclipse
n00b
n00b


Joined: 11 May 2017
Posts: 64
Location: Jiangsu/China

PostPosted: Mon Aug 20, 2018 9:11 am    Post subject: Re: Where is default $TERM set? Reply with quote

khayyam wrote:
PhoenixStarEclipse wrote:
In recent linux systems, xterm has 256color support, so xterm-256color doesn't have to appear. However, my $TERM happens to be xterm-256color. I've checked .bashrc and /etc/bashrc, but found nothing about $TERM. I'm just curious where it was initially set.

PhoenixStarEclipse ... it's set/reported by the terminal, or in the case of console by inittab/agetty. So, if you run screen, or tmux, within your xterm it'll detect the term supports 256 colours and set/report 'screen-256color'. For this reason you shouldn't set TERM in .bashrc or what-have-you.

HTH & best ... khay


So why did inittab set TERM to xterm-256color, something that doesn't even exist?
And why does simply running "xterm" gives me 256color support?
_________________
Think twice,code once.
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1001
Location: Frankfurt, Germany

PostPosted: Mon Aug 20, 2018 10:32 am    Post subject: Reply with quote

Quote:
xterm-256color, something that doesn't even exist?

What do you mean with: it doesn't exist?
Code:
# ls -la /etc/terminfo/x/xterm-256color
-rw-r--r-- 1 root root 3713 Mar 26 20:26 /etc/terminfo/x/xterm-256color

# qfile /etc/terminfo/x/xterm-256color
sys-libs/ncurses (/etc/terminfo/x/xterm-256color)
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Mon Aug 20, 2018 1:37 pm    Post subject: Re: Where is default $TERM set? Reply with quote

PhoenixStarEclipse wrote:
In recent linux systems, xterm has 256color support, so xterm-256color doesn't have to appear. However, my $TERM happens to be xterm-256color. I've checked .bashrc and /etc/bashrc, but found nothing about $TERM. I'm just curious where it was initially set.

khayyam wrote:
[...] it's set/reported by the terminal, or in the case of console by inittab/agetty. So, if you run screen, or tmux, within your xterm it'll detect the term supports 256 colours and set/report 'screen-256color'. For this reason you shouldn't set TERM in .bashrc or what-have-you.

PhoenixStarEclipse wrote:
So why did inittab set TERM to xterm-256color, something that doesn't even exist?

PhoenixStarEclipse ... read carefully, the statement about "inittab" was prefaced with "in the case of console", and as I said, for xterm, urxvt, st, etc, TERM would be set by the terminal itself.

PhoenixStarEclipse wrote:
And why does simply running "xterm" gives me 256color support?

Because x11-terms/xterm supports 256 colours and so is distinct (terminfo wise) from the original xterm.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum