Since this was a source of confusion for me in the past, I like to make it visually obvious when I’m inside an ssh session in gnome-terminal, vs. on the local machine. This is the best solution I have found so far:
ssh-done() { setterm -term linux -inversescreen off; } ssh() { setterm -term linux -inversescreen on; /usr/bin/env ssh $*; ssh-done; }
The reason why ssh-done is exposed as a separate function is that when ending ssh through Ctrl+C (for example, while at the password prompt), this gives you the ability to manually reset the terminal to normal again.
setterm in theory would also allow you to manually select a foreground and background color, though this didn’t work to well for me; in particular, it broke in various cases when commands tried to colorize their own output.
Totally awesome would be the ability to script gnome-terminal to switch the profile, but this doesn’t seem to exist yet.