~/.bash_profile

Page Tags
bash

Example of my ~/.bash_profile file.

PS1=Change Bash Prompt (PS1) color based on your environment dev, test, uat or prod.

zDu=Sort directories on their sized.


##############################################################################################################################

Escape="\033";
Reset="${Escape}[0m";
BlackF="${Escape}[30m";   
RedF="${Escape}[31m";   
GreenF="${Escape}[32m";
BlueF="${Escape}[38;5;33m";
YellowF="${Escape}[33m";

# BlueF="${Escape}[0;34m";
PurpleF="${Escape}[0;35m";
CyanF="${Escape}[0;36m";

zEnvironment=$ENV
if [[ "$zEnvironment" = *"dev"* ]]
then
    zUsername="${GreenF}$zEnvironment-\u${Reset}"
    
elif [[ "$zEnvironment" = *"test"* ]]
then
    zUsername="${CyanF}$zEnvironment-\u${Reset}"
    
elif [[ "$zEnvironment" = *"uat"* ]]
then
    zUsername="${PurpleF}$zEnvironment-\u${Reset}"
    
elif [[ "$zEnvironment" = *"prod"* ]]
then
    zUsername="${RedF}$zEnvironment-\u${Reset}"
    
else
    zUsername="${RedF}$zEnvironment-\u${Reset}"
fi

# zUsername="${GreenF}\u${Reset}"
# zUsername="${RedF}$zEnvironment-\u${Reset}"
zDirectory="${BlueF}\w${Reset}"
PS1="\t [$zUsername@\H: $zDirectory]\\$ "

##############################################################################################################################



LS_COLORS="no=00:fi=00:di=00;37;44:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:"
export LS_COLORS

export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
# grep --color -E 'pattern|$' file
alias ls='ls -h --color=auto'

alias cd..="cd .."
alias vi="vim"
alias ze="tail -f /var/log/nginx/*error*.log"
alias za="tail -f /var/log/nginx/*access*.log"
alias znetwork.listening="netstat -antlp | grep LISTEN"
alias ztail.access="tail -f /var/log/nginx/*access.log"
alias ztail.error="tail -f /var/log/nginx/*error.log"

alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'


alias zServicesList="grep -r -H 'java' /etc/init.d/* | cut -d: -f1 | uniq"
alias zLogList="grep -r -H 'LOG_DIR=' /etc/init.d/* | cut -d: -f2 | uniq | sort"
alias zDu="du -sh * | sort -h"

 


Created Wed, Aug 3, 2016 8:24 PM by Ahmet Faruk Bişkinler
Last Updated Wed, Jun 21, 2017 10:45 AM by Ahmet Faruk Bişkinler