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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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:
at the end of your
.bashrcfile on the remote machine. the\033[42mis 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.