I’m starting to put this in ~/.bashrc of all my servers now:
1 2 3 4 5 6
When I log into the machine, the screen window title (which displays on the hard status line, and in turn my urxvt window title bar) automatically changes to the hostname of the machine I’m logged into. I used to set this manually, but now I don’t have to, yay!
If your distro doesn’t set up your environment so ~/.bashrc is sourced upon login, you’ll want to put this into ~/.bash_login instead.
To get this code on a lot of servers at once, save the above snippet to a file called “prompt-command.sh” and execute:
Of course, change “hostname1”, “hostname2”, etc… to the real hostnames of your machines.