Change terminal colour based on SSH session
Yes, you can by changing the PS1
value in .bashrc
file on every hostname where you are connecting with ssh
.
See this answer to view how to costumize as you like the bash changing the PS1
value.
On my machine (radu@Radu) I have in .bashrc
:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;35m\]\u@\h\[\033[00m\]:\[\033[01;34m\] \w\[\033[01;37m\] > '
On the hosted machine (radu@ubuntu) I have:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;35;40m\]\u@ubuntu\[\033[00;40m\]:\[\033[01;34;40m\] \w\[\033[01;32;40m\] > '