How do I customize the stock terminal?

This behaviour is controlled by the PS1 variable for all terminals, xfce, KDE’s konsole, alacritty, xterm, …

Open your ~/.bashrc and put the following at the end for a change:

# when system is accessed via SSH, hostname with light grey background
if [[ $(pstree -s $$) = *sshd* ]]; then sshbg="\[\033[48;5;7m\]"; fi
# when used as root, change username to orange and '#' to red for prompt
if [ $(id -u) -eq 0 ]; then usercol="\[\033[38;5;3m\]"; hashcol="\[\033[38;5;1m\]"; else usercol="\[\033[38;5;2m\]"; fi
# bash PS1 prompt. $(realpath .) instead of \w avoids symlink paths
PS1="${usercol}\u\[$(tput sgr0)\]@\[$(tput sgr0)\]\[\033[38;5;4m\]${sshbg}\h\[$(tput sgr0)\]:\[$(tput sgr0)\]\[\033[38;5;6m\]\w\[$(tput sgr0)\]${hashcol}\\$ \[$(tput sgr0)\]"
unset sshbg rootcol hashcol

Best if you delete any other line which starts with PS1 in your current .bashrc.

4 Likes