* Open your .bash_profile
(since OS X 10.8) — or (for 10.7 and earlier): .profile
or .bashrc
or /etc/profile
(depending on availability)
* Add the following lines:
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Want host ? Add \[\033[32m\]\h:
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[33;1m\]\w\[\033[32m\]\$(parse_git_branch)\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
The first line changes the bash prompt to be colorized, and rearranges the prompt to be “username@hostname:cwd $”
The next two lines enable command line colors, and define colors for the ‘ls’ command
Finally, we alias ls to include a few flags by default. -G colorizes output, -h makes sizes human readable, and -F throws a / after a directory, * after an executable, and a @ after a symlink, making it easier to quickly identify things in directory listings.
留言列表