Colourful SSH prompt

11-29-2021
So you don't think you're executing that command locally when you're logged in remotely.

To clearly see that you are logged in to a computer via SSH, you better have a clear prompt. This prevents mistakes.

For a nice SSH I do the following things:
  1. Make sure that .bashrc is executed after logging in via SSH (it is not by default). Then you at least have the path, etc. set correctly in your SSH window.
  2. Show with a clear color in the prompt that you are working remotely.

I do that by modifying the .bash_profile file (on the remote PC you log in to). For me, .bash_profile was empty.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

PS1='\[\033[1;36m\]REMOTE! ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033 [00m\]\$ '

★ㄥinuメ★ TᎥƤ乙

View all 40 tips
or follow the
RSS-feed.
 
×
×