Like you said, tutorials on how to change the color on the network enough, and they all boil down to what we put in PS1 something (in ~/.bashrc
PS1="\$(if [[ \$? == 0 ]]; then echo \"\[\033[01;32m\]\342\234\223\"; else echo \"\[\033[01;31m\]\342\234\227 error:\$?\"; fi) [\@] \[\033[01;37m\] \[\033[01;31m\]\u@\h\[\033[01;34m\] \w $\[\033[00m\] "
So, if you want root access to have another color of this invitation in the same PS1 script to check whether you are root and set the other color (which codes correspond to which difficult to find - for example here
). Many of us forget that it is possible to do anything: in my example verified as successfully completed the last command, but in the same way you can check what we are)
And having SSH access to your remote machine you can do the same things on it (just with other colors) - when connected you will be greeted by a colored prompt commands.
If it doesn't work (maybe I have only this bug appeared) or you have a few people go to the remote machine under the same name and don't want to see the colors each other, it is possible to put there a file (let's call it ~/.bashrc_ssh
) and supply it with the value of PS1. To connect with this option:
ssh username@host-t "bash --rcfile ~/.bashrc_ssh -i"
It will look something like this:
Thus, when connecting (no matter where) to a remote machine, you will be able to get yourself a bright (red to green) the invitation to enter commands. For convenience for this long option, of course, is to make the alias