How to get coloured terminal over ssh?
I haven't used my old MBP 13 for nearly a month. This evening I picked it up and opened the iTerm2 then connected to my home server through ssh. I noticed I get a white-black colored terminal. What's wrong? I remembered it was colorful when I logged into this machine last time using iTerm2 on my MBP 15.
Firstly, I checked the version of iTerm2, it was a bit old, so I updated it first. Unfortunately, it doesn't help. I noticed I was using bash instead of zsh on this machine. So I ran chsh and changed the shell from bash to ssh. It also doesn't help. Then I find this answer from stackoverflow.com. A comment in this answer reminded me: I should check and compare the terminal configuration in iTerm2. So I found the secret!
Command + ,
open the preference, then click the profiles
tab, then change the Report terminal type
from xterm
to xterm-256
color, that's it!