Skip to content

Instantly share code, notes, and snippets.

@sahya
Created November 9, 2022 04:30
Show Gist options
  • Save sahya/db12d4e51e896c569b4428e53a9b8ba9 to your computer and use it in GitHub Desktop.
Save sahya/db12d4e51e896c569b4428e53a9b8ba9 to your computer and use it in GitHub Desktop.
change prompt appearance
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$(parse_git_branch) \d \A \n\\$ \[\033[00m\]
@sahya
Copy link
Author

sahya commented Nov 9, 2022

# /etc/profile.d/history.sh
export HISTTIMEFORMAT='%F %T '
export HISTSIZE=2000
export HISTFILESIZE=100000
export HISTIGNORE='history:pwd:ls:ls *:ll:w:top:df *'      # 保存しないコマンド
export HISTCONTROL=ignoreboth                              # 空白、重複履歴を保存しない
export PROMPT_COMMAND='history -a; history -c; history -r' # 履歴のリアルタイム反映

# bash_profile
export PS1="\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W \$(parse_git_branch) \d \A \n\\$ \[\033[00m\]"
export HOSTALIASES=~/.hosts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment