Skip to content

Instantly share code, notes, and snippets.

@peterroth
Last active July 21, 2023 14:43
Show Gist options
  • Save peterroth/0fee3de793e001d5a46e841dfd9cd66a to your computer and use it in GitHub Desktop.
Save peterroth/0fee3de793e001d5a46e841dfd9cd66a to your computer and use it in GitHub Desktop.
How to modify .bashrc to show "localhost" if we are working on the local machine and show the remote machine's name if we are logged in on a remote one in the terminal's header
case "$TERM" in
xterm*|rxvt*)
if [ $(hostname) == proth-laptop ]; then
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}localhost: \w\a\]$PS1"
else
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
fi
;;
*)
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment