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
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
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:
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
to add colours to more tools.