Ubuntu – Automatically change Terminal colors on remote connection

command linegnome-terminalssh

Is there a way to automatically apply a terminal profile when connected to a remote machine via SSH?

I'd like more obvious visual cues that I'm connected to a remote machine than the user/host displayed on each terminal line. I spend most of my day connected to multiple machines and it can get confusing.

Best Answer

Srigelsford from the Ubuntu forums recommends this:

I created several profiles in gnome-terminal with the settings I wanted, then created aliases like the below example to ssh to ares. The Ares profile has a red background.

alias -p ares='gnome-terminal --window-with-profile=Ares -x bash -c "ssh ares"; exit'

The pitfall of this is that it cannot be done in your existing terminal window, it launches another. My alias closes the existing one after launching the new one, but you can stop that by removing the ; exit from the end.

Just create as many profiles as you like, and associate each server to a profile in an alias. To launch just type the name of the alias $ares

Related Question