I thought that colored text was just something dictated by my gnome terminal preferences, however, I've discovered there's something slightly more to this because when I'm on my ubuntu VPS, text that should be colored (git commands for example) are just white.
So my first question is, why does my vps have no colors and can I get them "back" relatively easily?
Secondly, just so there is a visual distinction between my local terminal and the VPS, is there a configuration file on the server I can edit, so that all text that normally would be white is now yellow or something?
A few times I've been confused and then realised I'm actually logged into my VPS 😛
Best Answer
There are different files/options controlling this for different programs. For example, to get
ls
tp print in color, you can usels --color=tty
(which is set by default on Ubuntu). Forgrep
, you can usegrep --color=auto
. This is handled by the programs themselves, so it's not set in the terminal emulator or the shell. Anyway, to turn on these two options, you can create aliases to them. Edit (or create if not there)~/.bash_aliases
and add these lines:Then, open a new terminal (or run
. ~/.bash_aliases
) and you will have coloredls
andgrep
output.Anyway, for
git
, this is set in your~/.gitrc
file (see, for example, here). The easiest trick would be to just copy the one from your machine to the server.As for differentiating the terminals, the easiest approach would be to color your prompt (
PS1
). This is set in~/.bashrc
. You can find more details here and an app that simplifies it here but for example, you could use something like this:Which produces:
and
Which produces: