Skip to content

Instantly share code, notes, and snippets.

@islomar
Last active August 29, 2015 14:10
Show Gist options
  • Save islomar/f9430b6bed7bb69b622c to your computer and use it in GitHub Desktop.
Save islomar/f9430b6bed7bb69b622c to your computer and use it in GitHub Desktop.
Change terminal colours when connecting via SSH to another machine
http://elafosobrerailes.blogspot.com.es/2011/08/cambiar-los-colores-del-terminal-cuando.html
https://gist.github.com/eLafo/1125487#file-colored_ssh-sh
======
Steps
======
1.- Install sshpass
sudo apt-get install sshpass
2.- Step 2
Create a file "colored_ssh.sh":
#!/bin/bash
BACK=$4
FORE=$5
setterm -term linux -back ${BACK:='default'} -fore ${FORE:='default'} -clear
sshpass -p ${2} ssh -l ${1} ${3};setterm -term linux -back default -fore default;clear
3.- Step 3
In .bash_aliases (just an example):
alias ssh-production="colored_ssh.sh <username> <password> <hostname> <background_color> <foreground_color>"
4.- Step 4
Execute in Terminal something like:
ssh-production <username> <password> <hostname> red black
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment