I’ve found that anytime I spin up an Ubuntu system, whether in Digital Ocean, Google Cloud, or even through Windows Subsystem for Linux, color doesn’t seem to be working properly.
To fix this, there is a handy workaround that is very simple to implement.
First, let’s create a bash alias so that launching Tmux will actually launch with color settings configured. Start by editing the following file.
vi ~/.bash_aliases
Then add the following line.
alias tmux="TERM=xterm-256color tmux"
Now we will modify our Tmux configuration file as well.
vi ~/.tmux.conf
And add the following line.
set -g default-terminal "screen-256color"
Then we will restart Tmux.
tmux kill-server && tmux
Or you could just run these commands.
sudo echo "alias tmux=\"TERM=xterm-256color tmux\"" >> ~/.bash_aliases
sudo echo "set -g default-terminal \"screen-256color\"" >> ~/.tmux.conf
tmux kill-server && tmux
That’s it! Launch Tmux and you should now have color.
