I have a bit of an odd issue as far as I can tell. When I use tmux I don't get color within the terminal (all text is white, even for things like ls), but my colors work perfectly for vim and other things like that.

In my .tmux.conf file I have the line set -g default-terminal "screen-256color", which is what most people say solved their problems. I also tried starting tmux by typing tmux -2, but that doesn't change anything.

I'm kind of at a loss at this point, so thanks in advance for any help you can offer!

OS: Ubuntu 16.04

Tmux Version: 2.1


I can help you solve the symptom, but not the root of the problem. The design of the prompt is configured in the variable PS1.

Outside tmux, this is the value:

$ echo ${PS1} # outside tmux
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

This is the value inside tmux:

$ echo ${PS1} # outside tmux

to fix the problem, you can run this command inside tmux, and the prompt will immediately look normal for the current window:

PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

edit: I solved it by adding the following line to ~/.tmux.conf

set -g default-terminal "screen-256color"
| improve this answer | |
  • The last line saved my time! happy bashing :) – Masked Man Sep 5 '19 at 17:53

A simple way to solve this: open .bash_profile

vi .bash_profile

Save the following config's

export PS1="\[$(tput bold)$(tput setb 2)$(tput setaf 2)\]\u@\h:\w $ \[$(tput sgr0)\]"
  alias ls='ls --color'
  alias dir='dir --color'
  alias vdir='vdir --color'
  alias grep='grep --color'
  alias fgrep='fgrep --color'
  alias egrep='egrep --color'

Source the bash profile

source .bash_profile

There will be colours on tmux

| improve this answer | |

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.