Everyone knows that feeling: when you have many consoles open at the same time connected via ssh to various servers. In this post I’m going to show a simple trick that allows you to change the background whenever you ssh to a server and changes it back when you logout - well, at least if you are using KDE (or have konsole installed).
For example, I have a virtual linux system that I call “Puffin”. I’ve created an alias “ssh-puffin” to login via ssh.
I have setup this alias to change the background of konsole:
And then, after I log out, the konsole switches back to the local profile (and gives a warm and fuzzy welcome-back message).
Step 1: Add konsole profile(s)
Create konsole profiles and corresponding color schemes for your local system (“Local”) and remote systems (“Puffin”). You only need to really create the color schemes, but I always create a separate profile with the same name. This is done by going to Settings of a konsole window and selecting “Manage Profiles”. You can access the color schemes by clicking edit (or new) and then clicking on Appearance.
You can, of course, change the console appearance in other ways.
Step 2: Modify .bashrc
Add the following to your .bashrc file:
alias resetcolors="konsoleprofile colors=Local" alias ssh-puffin="konsoleprofile colors=Puffin; ssh puffin; resetcolors; echo 'Welcome back'"'!'
If you have many remote servers, you may want to add your .bashrc file to github or the cloud™.
Step 3: Enjoy awesomeness
.bashrc, you can then log into the server using your alias.
I first figured out how to do this from a blog post by Abdussamad.