Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 645

Answer by Kamil Maciorowski for Shell prompt colored outside of tmux, but not in tmux; how can I get colored prompt in tmux?

$
0
0

I assume the shell is Bash.

In Ubuntu the skeletal (default) .bashrc contains this or similar snippet:

# set a fancy prompt (non-color, unless we know we "want" color)case "$TERM" in    xterm-color|*-256color) color_prompt=yes;;esac

Your ~/.bashrc started as a copy of the skeletal one and it still contains the snippet (unless you edited it out, but you probably didn't).

Most likely in tmux your $TERM is tmux or tmux-256color. tmux-256color would be detected by the snippet and there would be no problem, so apparently in your case the value is tmux (verify with echo "$TERM" in a shell inside tmux).

To enable colored prompt when $TERM expands to tmux, edit your ~/.bashrc, locate the snippet and change the relevant line to:

    tmux|screen|xterm-color|*-256color) color_prompt=yes;;

(I included screen to solve the same problem for GNU Screen in advance, in case you ever use it.)

Existing shells will not be magically fixed, but prompts in new shells (e.g. in newly created tmux panes) will be colored.


Viewing all articles
Browse latest Browse all 645

Trending Articles