Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Xubuntu 12.04, and when I use the Terminal I get colored filenames from ls. But inside tmux, everything ls prints is white. I know my tmux supports color, though, because I get color syntax highlighting when I run vim. My ~/.tmux.conf has this line already:

set -g default-terminal "screen-256color"

Here are some environment variables (from within tmux):

$ env | grep COLOR
$ echo $TERM

How can I get ls to show me color when inside tmux?

share|improve this question
Your LS_COLORS is a bit sparse. Try eval "$(dircolors)". – jw013 Oct 17 '12 at 23:05
Post the output of type ls when inside tmux. – phunehehe Oct 17 '12 at 23:41
Yes, or dircolors -p > clrdb.txt (-p is --print-database) and then examine it peace and quiet. If you find patterns that apply to the files you are listing, as well as (for example) the --color=always option (would be a fair bet) on type ls (as mentioned), and still no colors, ls shouldn't be where the shoe hurts. If you have an alias or anything that blocks ls, try \ls and give the color option explicitly. – Emanuel Berg Oct 18 '12 at 0:20
type ls gives ls is /bin/ls, and after saying source ~/.bashrc it gives ls is aliased to 'ls --color=auto', so the problem was I wasn't sourcing ~/.bashrc. Thanks! – Paul A Jungwirth Oct 18 '12 at 16:36
up vote 9 down vote accepted

ls don't outputs colors by default, usually it is an alias to ls --color=auto setted in .bashrc. Check if you're invoking ls directly or through an alias with type ls.

If it outputs ls is /bin/ls maybe your .bashrc wasn't loaded when you created the tmux session. If so, try to reload it with source ~/.bashrc.

share|improve this answer
Yep, looks like the problem was that I wasn't sourcing ~/.bashrc. Could have sworn I checked that... :-) Thanks! – Paul A Jungwirth Oct 18 '12 at 16:34
Funny, sometimes we're looking far away but the answer is in front of us :) – Pedro Lacerda Oct 18 '12 at 23:32

Have you tried forcing tmux to colorize things by invoking it with -2 as a parameter?

share|improve this answer
Did you mean --color=always? My ls didn't recognizes -2. – Pedro Lacerda Oct 18 '12 at 1:19
No, I meant -2 ... but as a parameter for tmux, not ls. – tink Oct 18 '12 at 1:44
Sorry, I misread your answer. :-1 – Pedro Lacerda Oct 18 '12 at 1:47
I was already running tmux -2, but that's good advice if anyone else has this problem. – Paul A Jungwirth Oct 18 '12 at 16:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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