Last active
December 16, 2015 09:39
-
-
Save xguse/5414559 to your computer and use it in GitHub Desktop.
Generic yet functional bash prompt template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# Setup PATH env vars and variants | |
export PATH="${PATH}:/usr/local/bin:${HOME}/bin" | |
## aliases go here | |
alias ls="ls --color=auto -h" | |
alias ll='ls -lh' | |
alias la='ls -Ah' | |
alias l='ls -CFh' | |
# Add an "alert" alias for long running commands. Use like so: | |
# sleep 10; alert | |
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo | |
error)" "$(history|tail -n1|sed -e | |
'\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' | |
# Alias definitions. | |
# You may want to put all your additions into a separate file like | |
# ~/.bash_aliases, instead of adding them here directly. | |
# See /usr/share/doc/bash-doc/examples in the bash-doc package. | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
# enable programmable completion features (you don't need to enable | |
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
# sources /etc/bash.bashrc). | |
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then | |
. /etc/bash_completion | |
fi | |
function prompt | |
{ | |
local WHITE="\[\033[1;37m\]" | |
local GREEN="\[\033[0;32m\]" | |
local CYAN="\[\033[0;36m\]" | |
local GRAY="\[\033[0;37m\]" | |
local BLUE="\[\033[1;34m\]" | |
local BLACK="\[\033[0;30m\]" | |
export PS1=" | |
${WHITE}\u${GREEN}@${BLUE}\h ${WHITE}\t ${CYAN}\w${GRAY}${WHITE}: | |
" | |
} | |
prompt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment