My problem:

I want to run ncurses in 256-colors mode in the gnome terminal.

I already know that you can turn on this color mode with:

# export TERM=xterm-256color

But this solution is not permanent. When ever a new Gnome terminal is opened, it returns to 8 color support again.

So how can I export TERM, such that this solution above becomes permanent?


Add the command you wish to be applied to every terminal to your .bashrc file, in your home directory:

echo 'if [[ $TERM == @(xterm|screen) ]]; then
    export TERM=$TERM-256color;
fi' >> ~/.bashrc

And it will be run every time you open a new shell.

  • 1
    Edited to check the old $TERM value; it is outright wrong to force xterm-256color if the old value is something like screen or linux. – grawity Jul 23 '14 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.