Skip to content

Instantly share code, notes, and snippets.

@VSZM
Last active August 9, 2019 09:58
Show Gist options
  • Save VSZM/ae949a794f72037d208f119dc3f0175f to your computer and use it in GitHub Desktop.
Save VSZM/ae949a794f72037d208f119dc3f0175f to your computer and use it in GitHub Desktop.
VSZM's Generic .bashrc on non-restricted environment with GUI
function nonzero_return() {
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "$RETVAL"
}
export PS1="\[\e[32m\]\u\[\e[m\]@\[\e[33m\]\h\[\e[m\] \[\e[31m\]\w\[\e[m\][\`nonzero_return\`]\n\\$> "
export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
export LESS=" -R "
export ENV=local
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=50000
HISTFILESIZE=500000
#https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html
alias ls="grc -es --colour=auto ls"
alias ll="ls -lAh"
alias grep="grep --color=auto"
alias mkdir="mkdir -pv"
alias path="echo -e ${PATH//:/\\n}"
alias ping="ping -c 5"
alias histgrep="history | grep"
alias psgrep="ps -ef | grep"
alias sshoff="mv ~/.ssh/id_rsa ~/.ssh/id_rsa.backup && mv ~/.ssh/id_rsa.pub ~/.ssh/id_rsa.pub.backup && mv ~/.ssh/config ~/.ssh/config.backup && echo 'ssh public key authentication turned off'"
alias sshon="mv ~/.ssh/id_rsa.backup ~/.ssh/id_rsa && mv ~/.ssh/id_rsa.pub.backup ~/.ssh/id_rsa.pub && mv ~/.ssh/config.backup ~/.ssh/config && echo 'ssh public key authentication turned on'"
alias rmdir="rm -rf"
alias mvnverify="mvn clean verify -Dskip.integration.tests=false -Dmaven.test.failure.ignore=false"
alias pip="pip3"
alias git-list-large-objects="git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest"
alias refresh_bash="source ~/.bashrc"
# confirmation #
alias mv="mv -i"
alias cp="cp -i"
alias ln="ln -i"
# cycle through options with tab
bind TAB:menu-complete
# git auto complete
source ~/git-completion.bash
echo "Your environment is setup and ready to go VSZM!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment