Last active
January 3, 2023 18:52
-
-
Save jbwillis/d3cb2d43cdddad47f106c77fc30c3f65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom .bashrc that does some basic setup that I like | |
# add this to ~/ as .bashrc_custom, then add the following line to .bashrc | |
# source ~/.bashrc_custom | |
# source this again | |
alias config_src="source ~/.bashrc_custom" | |
##### | |
# PS1 that shows git branch if applicable | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[1;32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \$ " | |
##### | |
# alias for common git commands | |
alias ga="git add" | |
alias gsa="git status" | |
alias gcm="git commit -m" | |
alias gdf="git diff" | |
alias gsubup="git submodule update --init --recursive" | |
alias gpsubdir="find . -name '.git' -type d | sed 's/\/.git//' | xargs -P10 -I{} git -C {} pull -v" | |
##### | |
# PS alias | |
alias psg="ps -A | grep" | |
#### | |
# Customize the bash history log | |
# taken from https://www.shellhacks.com/tune-command-line-history-bash/ | |
export HISTTIMEFORMAT="%h %d %H:%M:%S " | |
export HISTSIZE=10000 | |
export HISTFILESIZE=10000 | |
shopt -s histappend | |
shopt -s cmdhist | |
export HISTCONTROL=ignoreboth:erasedups | |
export HISTIGNORE="ls:ll:la:cd:ps:history" | |
#### | |
# Up/Down Arrows use already typed command for history search | |
bind '"\e[A":history-search-backward' | |
bind '"\e[B":history-search-forward' | |
#### | |
# cd shortcuts | |
alias ..="cd .." | |
alias ...="cd ../.." | |
alias ....="cd ../../.." | |
alias .....="cd ../../../.." | |
alias ......="cd ../../../../.." | |
alias .......="cd ../../../../../.." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment