How to distinguish a terminal window currently connected via SSH

sshterminal

I'm coming from Windows, where I used to use Putty whenever I needed to connect to a server via SSH.

On MacOS this is much easier, as I can ssh into the server directly from the terminal. This is nice, but comes with a caveat: I might have a few terminal windows open at the same time, and mistake a terminal opened locally with a terminal ssh'ed into a remote server (and make nasty mistakes).

Is there any way I can visually distinguish a terminal window connected via ssh, from another one on my local machine?

Best Answer

Look to the title of the window, or the title of the tab if you are using several tabs:

enter image description here

That won't be enough for me to avoid making mistakes ? – Benjamin

I was thinking about something like the window changing color somewhere. Don't even know if that's technically possible, though. – Benjamin

Assuming a worst case when you are unable to change remote's prompt, edit you mac's terminal prompt in order to make most clear if the terminal is at a client of a Mac of yours.

If you use Tmux, configure non defaults status-fg status-bg so that your Mac's local terminals use a different Tmux color than what is configured at your servers.