Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

When I connect over ssh to remote hosts everything is just a single font/color. I would like to have colours like I do locally e.g. green for executable and blue for symlinks etc. And such that when I run $ git diff on the ssh host it shows me diff with colours =)

share|improve this question
    
Is that an Ubuntu server you're connecting to? –  Stefano Palazzo Dec 5 '10 at 20:42
    
@stefano-palazzo: to Debian. –  Dima Dec 6 '10 at 0:46

3 Answers 3

up vote 10 down vote accepted

Hm. since it was xterm on the server, I figured something was wrong with .bashrc

And indeed! --color=auto works only when you are connected to TTY. Changing everything to simply --color in .bashrc and everything is in pretty colours now.

share|improve this answer
    
You should mark this as the answer :) –  djeikyb Feb 23 '11 at 2:44
11  
It would help this answer a lot if you said where you put --color=auto. .bashrc on the server? What commands? –  rfay Aug 24 '13 at 19:37
    
Since this is an old question which is still relevant, I just wanted to add that on Ubuntu systems, the default .bashrc has a case statement which defines which terms are allowed color. If you find the "case "$TERM$" in" line in your .bashrc, adding "xterm) color_prompt=yes;;" will also enable color. Also you can uncomment the "force_color_prompt=yes" line to globally enable it always. –  Mike E Jul 6 at 17:58

What's the content of your XTERM env variable on the server when you connect to it?

~ > export | grep -i term
TERM=xterm
share|improve this answer
    
$ export | grep -i term declare -x TERM="xterm" –  Dima Dec 6 '10 at 0:36

Seems like colors were already set in ~/.bashrc for me and the issue is that ssh does not use the bashrc file. You can use bashrc in your ssh session by adding the following to ~/.bash_profile:

if [ -f ~/.bashrc ]; then
      . ~/.bashrc
fi
share|improve this answer

Your Answer

 
discard

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.