Set Konsole's TERM variable to xterm-256color by default

Bug #1548032 reported by Nightfall
This bug affects 3 people
Affects Status Importance Assigned to Milestone
KDE Base
Won't Fix
konsole (Ubuntu)

Bug Description

It would be great to have applications like vim use nice color schemes (i.e. 256 colors) by default in Konsole. To make this happen, Konsole needs to indicate its 256 color support via the TERM variable.

One way to do this might be to patch /usr/share/konsole/Shell.profile (tested on a recent Kubuntu Xenial daily - no custom Konsole profile existing):
--- current/Shell.profile 2016-02-21 09:00:57.568940764 +0000
+++ 256colors/Shell.profile 2016-02-21 09:01:23.821266723 +0000
@@ -1,4 +1,5 @@

Users' existing Konsole profiles would have to be adjusted manually.

For comparison, "echo $TERM" in several distributions' (current live systems) main terminal emulators prints:

xterm-256color in:
Ubuntu Xenial (recent daily) - GNOME Terminal
Fedora 23 (Workstation Edition) - GNOME Terminal
Fedora 23 (KDE) - Konsole (but xterm in Konsole profile, see Fedora Wiki URL below)

xterm in:
Xubuntu Xenial (recent daily) - xfce4-terminal
Tanglu 3 KDE - Konsole
Tanglu 3 GNOME - GNOME Terminal

This KDE bug report from 2011 AFAICT indicates it's up to the user/distribution to make sure 256 colors are supported (see below) and then set TERM (in Konsole) accordingly:

256 color support via TERM=xterm-256color AFAICT needs /lib/terminfo/x/xterm-256color, which in (K)ubuntu (Xenial) is contained in ncurses-base and, according to this package's changelog, had been moved there in 2008. I don't know if anything else is needed - I've been using this TERM value for several years now in Kubuntu/Konsole and it worked/I didn't notice any specific breakage.

For more discussion on different methods to set TERM (2012/2013):

As a side note, using xterm-256color also had the nice side effect of enabling a colored Bash prompt in Konsole/Kparts by default (see default .bashrc).

Tags: kubuntu xenial
Revision history for this message
In , Pádraig (pdraig-redhat-bugs) wrote :

This is for
There is a central script for that feature that is used to enable 256 colors
by adjusting the TERM variable.
However to do that safely it must know the terminal can support this.
The preferred method is to check the $COLORTERM env variable
that many terminals set.
I suggest setting it COLORTERM to 'konsole'

I tested setting that variable manually, from the preferences menu,
where there is an option to add environment variables.
All worked as expected. Note when setting manually (per user) the file:
  ~/.kde/share/apps/konsole/Shell.profile file
is updated with:


Revision history for this message
In , Pádraig (pdraig-redhat-bugs) wrote :

Actually I just noticed a variable I could key on


Not as nice or standard as COLORTERM though.
If setting a default COLORTERM is awkward though,

Revision history for this message
In , Rex (rex-redhat-bugs) wrote :

seems it sets 3:

but yeah, I'm pretty sure we can do the COLORTERM thing

Revision history for this message
In , Rex (rex-redhat-bugs) wrote :

Looking closer, I think I'd feel better if you did use one of the KONSOLE_ environment variables after all.

doing otherwise may give a negative impact for kde users who don't use konsole.

I'm going to mark this WONTFIX here in kde-settings, but...
If that's not acceptable to you, please do feel free to re-open.

Nightfall (someoneelse)
tags: added: kubuntu
tags: added: xenial
Revision history for this message
Nightfall (someoneelse) wrote :

Please note that the Red Hat bug watch bug (#845583) talks about setting COLORTERM for use in their specific init script which then would change TERM from "xterm" to "xterm-256color" in this case (at least in the version linked in that bug report).

This is not needed here (AFAICT) if, as proposed, the Konsole "Environment" setting is changed directly.

Revision history for this message
Nightfall (someoneelse) wrote :

Some more information on GNOME Terminal:

According to their bug tracker, GNOME Terminal/VTE does have TERM=xterm- 256color by default since 2014/2015: (the relevant commit seems to be

Red Hat bug report leading to this change:

Somewhat lengthy discussion on TERM in GNOME Terminal, also commenting on the Red Hat init script approach:

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in konsole (Ubuntu):
status: New → Confirmed
Changed in kde-baseapps:
importance: Unknown → Undecided
status: Unknown → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.