Skip to content

Instantly share code, notes, and snippets.

@adamchalmers
Created May 5, 2015 06:51
Show Gist options
  • Save adamchalmers/473830e7e1851166f709 to your computer and use it in GitHub Desktop.
Save adamchalmers/473830e7e1851166f709 to your computer and use it in GitHub Desktop.
Basic colored prompt for 1103 students
TERM=xterm-256color
export PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
# 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
RESET=$( tput sgr0 )
export PS1="\[$FGGRN\][\u \[$FGBLU\] \W\[$FGRED\]\[$FGGRN\]]\$ \[$RESET\]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment