How to configure gnome-terminal to use xterm-256color by default?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Popsicle Puzzles
--
Chapters
00:00 How To Configure Gnome-Terminal To Use Xterm-256color By Default?
00:38 Accepted Answer Score 13
01:41 Answer 2 Score 5
01:53 Answer 3 Score 2
02:14 Thank you
--
Full question
https://superuser.com/questions/841016/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #debian #terminal #gnome
#avk47
ACCEPTED ANSWER
Score 13
Copying my answer from the same question @javabrett pointed out:
You were well advised not to change your startup scripts, specially ~/.bashrc
. Any "terminal detection" using current $TERM
or $COLORTERM
in ~/.profile
is merely a guess, and may, as you said, cause trouble when using other terminals (say, Putty or xterm). The terminal emulator is supposed to set $TERM
, and this should not be changed from within the shell.
Gnome terminal, AFAIK, does not offer a configuration to change its TERM
, but it does allow you to change your startup command, and that's all you need. Here is the trick:
Profile Preferences => Title and Command => Run a custom command instead of my shell
Then use the following command:
env TERM=xterm-256color /bin/bash
Just replace /bin/bash
with your preferred shell if it's different. And no, you can't use "$SHELL"
in that line for shell auto-detection ;) You have to hard-code it
ANSWER 2
Score 5
Beginning with gnome-terminal
version 3.16, it defaults to TERM=xterm-256color
.
ANSWER 3
Score 2
There's a good answer explaining how gnome-terminal
doesn't allow TERM
to be defaulted via its settings over at askubuntu.
It suggests that this is a compile-time option, so it appears that setting TERM
in a shell profile or startup script is the best and only option. You might create a wrapper script or alias if you prefer.