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

 
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: 71
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: 6227
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: 71
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
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
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 by '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)


Last edited by mike155 on Fri Feb 14, 2020 12:13 am; edited 1 time in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
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
reavertm
Developer
Developer


Joined: 05 Feb 2004
Posts: 265
Location: Wrocław

PostPosted: Fri Feb 14, 2020 12:02 am    Post subject: Reply with quote

Bummer then since at least mc built with ncurses doesn't seem to play nice with mouse in X11 terminal, when TERM is set to xterm-*color.

See https://midnight-commander.org/ticket/3954
_________________
Maciek
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Fri Feb 14, 2020 1:57 pm    Post subject: Reply with quote

So just change inittab if you are running OpenRC
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