客製化的Terminal .bashrc

個人的.bashrc配置,這邊備存一下。

#   -------------------------------
#   ENVIRONMENT CONFIGURATION
#   -------------------------------

#   Color Code
#   ------------------------------------------------------------
# Reset Color
#   ColorOff='\e[0m'
#
# Regular Colors (bold-> use 1; instead of 0;)
#   Black='\e[0;30m'
#   Red='\e[0;31m'
#   Green='\e[0;32m'
#   Yello='\e[0;33m'
#   Blue='\e[0;34m'
#   Purple='\e[0;35m'
#   Cyan='\e[0;36m'
#   White='\e[0;37m'
# High Intensity Colors (bold-> use 1; instead of 0;)
#   Black='\e[0;90m'
#   Red='\e[0;91m'
#   Green='\e[0;92m'
#   Yello='\e[0;93m'
#   Blue='\e[0;94m'
#   Purple='\e[0;95m'
#   Cyan='\e[0;96m'
#   White='\e[0;97m'
# Background
#   from black to white -> '\e[0;40m' ~ '\e[0;47m'
# High intensity Background
#   from black to white -> '\e[0;100m' ~ '\e[0;107m'
#
# add [] with escape character '\' for color code.


#   Change Prompt
#   ------------------------------------------------------------
#   http://koko.ntex.tw/wordpress/mac-terminal-bash-color/
#   ------------------------------------------------------------
export TERM="xterm-color"

if [[ $EUID -ne 0 ]]; then
  export PS1='\[\e[0m\]\[\e[1;95m\]  \[\e[0;34m\]\w\[\e[0m\] '
else
  export PS1='\[\e[0m\]\[\e[1;93m\]  \[\e[0;34m\]\w\[\e[0m\] '
fi

export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}\007"';

#   Set Paths
#   ------------------------------------------------------------
export PATH="/usr/local/git/bin:/sw/bin/:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/opt/ruby/bin:$PATH"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/
export PATH=$JAVA_HOME/bin:$PATH

#   Set Default Editor (change 'Nano' to the editor of your choice)
#   ------------------------------------------------------------
export EDITOR='code -w'

#   Set default blocksize for ls, df, du
#   from this: http://hints.macworld.com/comment.php?mode=view&cid=24491
#   ------------------------------------------------------------
export BLOCKSIZE=1k

#   Add color to terminal
#   (this is all commented out as I use Mac Terminal Profiles)
#   from http://osxdaily.com/2012/02/21/add-color-to-the-terminal-in-mac-os-x/
#   ------------------------------------------------------------
#   export LSCOLORS=ExFxBxDxCxegedabagacad
export GREP_OPTIONS='--color=auto'
export CLICOLOR=1
export LSCOLORS=Exfxcxdxbxegedabagacad

#   -----------------------------
#   MAKE TERMINAL BETTER
#   -----------------------------

alias cp='cp -iv'                           # Preferred 'cp' implementation
alias mv='mv -iv'                           # Preferred 'mv' implementation
alias mkdir='mkdir -pv'                     # Preferred 'mkdir' implementation
alias ll='ls -FGlAhp'                       # Preferred 'ls' implementation
alias less='less -FSRXc'                    # Preferred 'less' implementation
cd() { builtin cd "$@"; ls; }               # Always list directory contents upon 'cd'
alias cd..='cd ../'                         # Go back 1 directory level (for fast typers)
alias edit='code -w'                        # edit:         Opens any file in sublime editor
alias f='open -a Finder ./'                 # f:            Opens current directory in MacOS Finder
alias ~="cd ~"                              # ~:            Go Home
alias c='clear'                             # c:            Clear terminal display
alias which='type -all'                     # which:        Find executables
alias path='echo -e ${PATH//:/\\n}'         # path:         Echo all executable Paths


#   -----------------------------
#   APPLICATION ALIAS
#   -----------------------------
#
alias mysqls='sudo /usr/local/mysql/support-files/mysql.server'
alias mysql='mysql -u root -p'
alias ws='cd /Users/username/Workspace'

 

0 0 vote
Article Rating
guest
0 Comments
Inline Feedbacks
View all comments