Skip to content

Instantly share code, notes, and snippets.

@jjeffers
Created September 2, 2026 12:33
Show Gist options
  • Select an option

  • Save jjeffers/92ff50132d48146d338e25c004212085 to your computer and use it in GitHub Desktop.

Select an option

Save jjeffers/92ff50132d48146d338e25c004212085 to your computer and use it in GitHub Desktop.
Terminal color adjustment for ssh into different environments
ssh() {
# Change profile for a specific host
if [[ "$1" == "prod-server" ]]; then
# Set profile to Red (or any custom profile name you created)
echo -e "\033]50;SetTerminalHeader=PROD SERVER\a"
osascript -e 'tell application "Terminal" to set current settings of selected tab of front window to settings set "Pro"'
# Run SSH
command ssh "$@"
# Reset back to default profile on exit
osascript -e 'tell application "Terminal" to set current settings of selected tab of front window to settings set "Basic"'
else
command ssh "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment