Skip to content

Instantly share code, notes, and snippets.

@tabrez
Last active October 29, 2022 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tabrez/baafb9daa2828c6cf2fc64db242e36d9 to your computer and use it in GitHub Desktop.
Save tabrez/baafb9daa2828c6cf2fc64db242e36d9 to your computer and use it in GitHub Desktop.
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Control bash history
# http://www.biostat.jhsph.edu/~afisher/ComputingClub/webfiles/KasperHansenPres/IntermediateUnix.pdf
# https://unix.stackexchange.com/questions/48713/how-can-i-remove-duplicates-in-my-bash-history-preserving-order
# don't put duplicate lines or lines starting with space in the history.
export HISTCONTROL=ignoreboth:erasedups
# big big history size
export HISTSIZE=10000
# set history format to include timestamps
HISTTIMEFORMAT="%Y-%m-%d %T "
# when the shell exits, append to the history file instead of overwriting it
shopt -s histappend
# save all lines of a multiple-line command in the same history entry
shopt -s cmdhist
# check the window size after each command and, if necessary, update the values of LINES and COLUMNS.
shopt -s checkwinsize
# correct simple errors while using cd
shopt -s cdspell
# Auto-complete command from history using up and down arrow keys
# http://lindesk.com/2009/04/customize-terminal-configuration-setting-bash-cli-power-user/
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# Change command prompt
export PS1="\[\e[0;33m\]\A \W \$ \[\e[m\]"
# download from here: https://github.com/rupa/z
if [ -f ~/.local/bin/z.sh ]; then
. ~/.local/bin/z.sh
fi
if [ -f ~/.aliases ]; then
. ~/.aliases
fi
export PATH=$PATH:~/.local/bin:~/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment