Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Console 2 to launch msysgit's Bash shell in Windows. When I ssh to a server (either a SLES or RHLE server) and do an ls or use vi I don't get any colors. However, the colors DO work correctly if I use PuTTY. I haven't done any color customizations in Console 2, Bash, or PuTTY, and the colors on the servers (to my knowledge) haven't been changed at all.

After reading iTerm2 loses “ls” colors if I ssh to a server I tried ls --color=always and that does display some colors, but not all of them. It shows executable and folder colors (green and blue, respectively, in my case) but not zip files (should be red in my case). Again, PuTTY displays these correctly.

Aliasing a bunch of commands where I want color isn't a workable solution for me because I regularly access dozens of different servers and that interacts with the way other admins are using those servers.

Any ideas?

share|improve this question
check what 'echo $TERM' returns when you log in from both Console 2/putty. It is possible your bashrc or vimrc are set to only enable colours on terminals that definitely support it. i.e. in Arch linux you have to manually add in 'screen' as a terminal type for screen to have colours. Also, for aliasing, you can do it in your personal bashrc (~/.bashrc) and it will only affect you and not other admins. –  Justin Jan 25 '13 at 1:19
Console 2 reports cygwin while PuTTY reports xterm. Unfortunately I use a shared admin account on those servers so I don't have my own .bashrc file. –  user192665 Jan 25 '13 at 16:15
That's on step closer. I can do TERM=xterm ssh my.awesome.server -l username and I get my colors using ls again. vi completely breaks using that setting though. –  user192665 Jan 25 '13 at 16:29

2 Answers 2

up vote 2 down vote accepted

I believe you are looking for the LS_COLORS environment variable. This article has a nice write-up: http://www.bigsoft.co.uk/blog/index.php/2008/04/11/configuring-ls_colors

share|improve this answer
This definitely fixes the colors in ls. Oddly, something I changed caused vi to start displaying colors (or I was hallucinating when I thought it wasn't working). –  user192665 Jan 28 '13 at 23:01

Console2 is a "real" console emulator, but PuTTY run applications via pipes.

That means, that when ssh detects "no console window" (pipes) it switch to using ANSI escape sequences for displaying colors. But standard windows console does not support escapes, that's why when ssh detects it (and Console2 accordingly) it thinks that ANSI is not available and switch to using win32 API, which implementation there, I believe, is much poorly.

I know two tools bringing ANSI to windows console - ANSICON and my own ConEmu, but msys does not know about them and fails for detecting ANSI capability.

However, I have some thought about this - how to deceive certain applications that they are running in pipe terminal (PTY).

share|improve this answer

Your Answer


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