What I like on remote servers or anything not using git.
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
export PS1="\[\033[1;32m\]\u\[\033[1;00m\]@\[\033[1;31m\]\h\[\033[01;34m\] \w \[\033[1;00m\]\$\[\033[00m\]"
If I want the same colors but also with some git prompt stuff going on.
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Put your fun stuff here.
source /usr/share/git/git-prompt.sh
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWCOLORHINTS=true
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUPSTREAM=auto
export GIT_PS1_SHOWCOLORHINTS=true
export PROMPT_COMMAND='__git_ps1 "\[\[\033[1;32m\]\u\[\033[1;00m\]@\[\033[1;31m\]\h\[\033[1;34m\] \w \[\033[1;00m\]" "$ "'
Depending on the distribution the git-prompt.sh file is in different locations. I’ve tried other way of doing colors, while this is the ugliest it seems to not break things in subtle ways when doing non-interactive logins. The 00m is default colors, so my @ sign, the git prompt stuff, the $ and everything afterwards will use the terminal’s profile settings.
https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
![](https://jeffhouze.com/wp-content/uploads/2020/08/black-on-white.png)
![](https://jeffhouze.com/wp-content/uploads/2020/08/white-on-black.png)