Skip to content

Instantly share code, notes, and snippets.

@monosoul
Created October 20, 2021 11:12
Show Gist options
  • Save monosoul/7fb233dc268c95e737bfd137b77097fa to your computer and use it in GitHub Desktop.
Save monosoul/7fb233dc268c95e737bfd137b77097fa to your computer and use it in GitHub Desktop.
Nice bash prompt
# using tput commands
FGBLK=$( tput setaf 0 ) # 000000
FGRED=$( tput setaf 1 ) # ff0000
FGGRN=$( tput setaf 2 ) # 00ff00
FGYLO=$( tput setaf 3 ) # ffff00
FGBLU=$( tput setaf 4 ) # 0000ff
FGMAG=$( tput setaf 5 ) # ff00ff
FGCYN=$( tput setaf 6 ) # 00ffff
FGWHT=$( tput setaf 7 ) # ffffff
BGBLK=$( tput setab 0 ) # 000000
BGRED=$( tput setab 1 ) # ff0000
BGGRN=$( tput setab 2 ) # 00ff00
BGYLO=$( tput setab 3 ) # ffff00
BGBLU=$( tput setab 4 ) # 0000ff
BGMAG=$( tput setab 5 ) # ff00ff
BGCYN=$( tput setab 6 ) # 00ffff
BGWHT=$( tput setab 7 ) # ffffff
RESET=$( tput sgr0 )
BOLDM=$( tput bold )
UNDER=$( tput smul )
REVRS=$( tput rev )
if [ $EUID == 0 ]; then
export PS1="\[$FGRED\]\u\[$FGMAG\]@\[$FGCYN\]\h\[$RESET\]:\[$FGBLU\]\w\[$RESET\]\$ "
else
export PS1="\[$FGGRN\]\u\[$FGMAG\]@\[$FGCYN\]\h\[$RESET\]:\[$FGBLU\]\w\[$RESET\]\$ "
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment