Changing terminal profiles when connecting via SSH

124.105.***.***
7

Do you ever change the PS1 or terminal profile when connecting via SSH?

This will help you avoid wasting time wondering, 'Why isn't that file I just added in this directory?' {emo:onion-030.gif:50} while connected via SSH.


To implement this feature, you first need to override the ssh command in your SSH client.

Of course, there are many ways to override commands in Linux, but here we will introduce a simple way to set it up.

First, add the following shell script to a path with higher priority than /usr/bin (e.g., /usr/local/bin or ~/.local/bin ).

[code]#!/bin/bash


/usr/bin/ssh "$@"


# Reset the modified terminal profile on the SSH remote server to the default value

printf "\\e]111\\a"

printf "\\e]110\\a"[/code]


Then, add the following content to the remote shell profile of the target SSH connection.

[code]# omitted

if [ -n "$SSH_CONNECTION" ]; then

# Solarized dark theme

printf "\\e]11;#002b36\\a"

printf "\\e]10;#839496\\a"

fi

# omitted[/code]


Once all the work is done, you will be able to see a colorful terminal. {emo:onion-051.gif:50}


로그인한 회원만 댓글 등록이 가능합니다.

개발한당

KR | ID | EN
  • IDR
  • KOR
8.34 -0.01

2026.07.10 KEB 하나은행 고시회차 1159회

다가오는 한인 행사일정

  • 등록 된 일정이 없어요!