Change konsole appearance during SSH

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.

Before ssh session

I have setup this alias to change the background of konsole:

During ssh session

And then, after I log out, the konsole switches back to the local profile (and gives a warm and fuzzy welcome-back message).

After ssh session

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.

I created the Puffin background with GIMP using layers and an image from Wikimedia Commons by Richard Bartz.

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

After reloading .bashrc, you can then log into the server using your alias.

Acknowledgements

I first figured out how to do this from a blog post by Abdussamad.