How can I run ncurses program with 256 colors in the gnome terminal?

0

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?

user1861174

Posted 2014-07-23T12:56:46.447

Reputation: 127

Answers

0

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.

Andrew Stubbs

Posted 2014-07-23T12:56:46.447

Reputation: 454

1Edited to check the old $TERM value; it is outright wrong to force xterm-256color if the old value is something like screen or linux. – user1686 – 2014-07-23T15:02:03.750