Why do I lose ls' colors when I ssh to a server?
I would like those colors to be preserved. Is this possible? Should one do something on the server side?
The server doesn't use a colored ls command by default.
You can alias your ls command to always use colors in one of the server's shell configuration files (e.g. ~/.bashrc) with the --color=auto option.
alias ls='ls --color=auto'
Some additional remarks:
If the server runs Linux, the above should be enough to get colors working. You can use an LSCOLORS generator to manually specify the colors in a shell configuration file by adding:
If the server runs BSD / OS X, you additionally need the following for ls to automatically show colors (you then don't even need to specify an alias):
Also, here it's not LS_COLORS, but LSCOLORS, and the syntax is different (see the LSCOLORS generator output).
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
3 years ago
2 years ago