My Bash Profile
Since some of my friends are asking me my terminal setup, I think it will be a good idea to have a copy of my profile file here:
PS1:
I have my PS1 to display out just the user name and the current time. export PS1="\[\e[38;5;245m\][\t]\[\e[38;5;203m\] \u \[\e[38;5;254m\]> \[\e[0m\]"
Bash-git-prompt:
I also found this awesome github project helps git users navigate within the git folder quite easy. But it will break the PS1 I have setup earlier.
I ran brew install bash-git-prompt
to install the packages and then edit my profile file:
# git-bash-prompt
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
__GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
fi
# Custom PS1
PS1="\[\e[38;5;245m\][\t]\[\e[38;5;203m\] \u \[\e[38;5;254m\]> \[\e[0m\]"
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_SHOW_UPSTREAM=1
GIT_PROMPT_END="\n\[\e[38;5;245m\][\t]\[\e[38;5;203m\] \u \[\e[38;5;254m\]> \[\e[0m\]"
The custom PS1 part I added so the bash-git-prompt
will still output the PS1 in the style I preferred.
Others:
Here are other little configuration I have put in my profile file, includes ll
, ap
, av
and hn
.
alias ll='ls -l'
alias python='python2.7'
alias av='ansible-vault'
alias ap='ansible-playbook'
alias hn='hostname'
If you are using macOS and using Terminal
as your cli tool, you can just edit the .profile file under your home directory vi ~/.profile
.