Skip to content

Instantly share code, notes, and snippets.

@ilw
Created November 22, 2024 09:24
Show Gist options
  • Select an option

  • Save ilw/9fe32a1529d9465630b99c7d9b9392cd to your computer and use it in GitHub Desktop.

Select an option

Save ilw/9fe32a1529d9465630b99c7d9b9392cd to your computer and use it in GitHub Desktop.
bashrc_template
export CLICOLOR=1
export TERM=xterm-256color
export GREP_OPTIONS='--color=always'
alias ll="ls -laG"
alias llt="ls -latrG"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
# prompt
normal="\[\e[0m\]"
color1="\[\e[1;33m\]"
color2="\[\e[0;34m\]"
color3="\[\e[0;31m\]"
prompt_start="$color1"
prompt_time="$color1\t"
prompt_username="$color1\u"
prompt_at="$color2@"
prompt_hostname="$color1\h"
prompt_pwd="$color2\w"
prompt_branch="$color1\$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/')"
prompt_prompt="\n$color1$ $normal"
PROMPT="$prompt_start$prompt_time $prompt_username$prompt_at$prompt_hostname
$prompt_pwd$prompt_branch$prompt_prompt"
export PS1=$PROMPT
# History
# Save 5,000 lines of history in memory
export HISTSIZE=10000
# Save 2,000,000 lines of history to disk (will have to grep ~/.bash_history for full listing)
export HISTFILESIZE=2000000
# avoid duplicates..
export HISTCONTROL=ignoredups:erasedups
# append history entries..
shopt -s histappend
# after each command, save and reload history
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# Ignore redundant or space commands
export HISTCONTROL=ignoreboth
# Ignore more
export HISTIGNORE='ls:ll:ls -alh:pwd:clear:history'
# Set time format
export HISTTIMEFORMAT='%F %T '
# history search on arrow keys
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment