I'd like to create a setup on my local machine (Ubuntu GNOME) whereby the terminal window has a different background color depending on whether I'm logged in to my local machine or ssh'd into a remote machine.
Is there a way to do this?
In GNOME terminal, you reach it through the Application menu along the top of the screen or in the right corner of the window. In Preferences, click the plus symbol (+) next to Profiles to create a new theme profile. In your new profile, click the Colors tab.
So in terminal click right mouse button -> profiles -> profile preferences -> colors -> background -> choose black.
This doesn't do what you asked for, but it probably does what you want.
You can modify your .bashrc
(or equivalent shell init file) to set your prompt based on whether you're using ssh or not.
i.e. put something like:
if [ -n $SSH_TTY ]; then
export PS1=`echo -en '\033[42m\w\$ '`;
fi;
at the end of your .bashrc
file on the remote machine. the \033[42m
is an ANSI Escape Code that changes the background colour to green.
This way, the background colour of your terminal will be green (or magenta, or cyan, or whatever) only when you're logged in to a remote machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With