I use Mac and use iterm2 ssh login linux Server . but when exec ls the terminal is Black and White how to config then like mac colors the color


The default TERM type iTerm reports is xterm and that should be sufficient from your Mac's end of things to see colours. The problem is there are two things in play here: your local iTerm terminal and the remote machine and it's shell configuration. If you haven't setup your shell to show colour, it doesn't matter what your iTerm is reporting for TERM.

It sounds like the problem is on the remote end and that you haven't configured ls on your Linux system to output colours.

Try setting LS_COLORS in your environment after you ssh in to your Linux machine. Here is one way to do it:

export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32'

That should give you a fairly good chance of ensuring you see colours when you run ls on any directory. If you like the settings, make them permanent by adding that line to your ~/.bash_profile file on the Linux machine.

You can also use the newer, more generic, COLORS environment variable and point it to the /etc/DIR_COLORS file that should exist on most modern Linux installations. More tools will key off this than just ls so you'll see colour in tools like grep too. Add the following to your ~/.bash_profile:


to add colours to more tools.

| improve this answer | |

Set the Report Terminal Type value to

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .