Skip to content

Instantly share code, notes, and snippets.

@Speedy37
Last active July 10, 2020 10:59
Show Gist options
  • Save Speedy37/61966339a3c52461d90052d45bd7fbb8 to your computer and use it in GitHub Desktop.
Save Speedy37/61966339a3c52461d90052d45bd7fbb8 to your computer and use it in GitHub Desktop.
bash.bashrc
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# we have colors :-)
PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\\$\[\033[00m\] "
# Use this other PS1 string if you want \W for root and \w for all other users:
# PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h\[\033[01;34m\] \W'; else echo '\[\033[01;32m\]\u@\h\[\033[01;34m\] \w'; fi) \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\\$\[\033[00m\] "
alias ls="ls --color=auto"
alias dir="dir --color=auto"
alias grep="grep --color=auto"
alias dmesg='dmesg --color'
else
# show root@ when we do not have colors
PS1="\u@\h \w \$([[ \$? != 0 ]] && echo \":( \")\$ "
# Use this other PS1 string if you want \W for root and \w for all other users:
# PS1="\u@\h $(if [[ ${EUID} == 0 ]]; then echo '\W'; else echo '\w'; fi) \$([[ \$? != 0 ]] && echo \":( \")\$ "
fi
PS2="> "
PS3="> "
PS4="+ "
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment