Skip to content

Instantly share code, notes, and snippets.

@aquastripe
Forked from michaelklapper/.bashrc
Last active December 26, 2021 02:57
Show Gist options
  • Save aquastripe/34f981b1a949133d9c3d7d88877c601b to your computer and use it in GitHub Desktop.
Save aquastripe/34f981b1a949133d9c3d7d88877c601b to your computer and use it in GitHub Desktop.
Color up your bash history with the date time information of called commands.
MY_BASH_BLUE="\033[0;34m" #Blue
MY_BASH_NOCOLOR="\033[0m"
HISTTIMEFORMAT=`echo -e ${MY_BASH_BLUE}[%F %T] $MY_BASH_NOCOLOR `
HISTSIZE=20000
HISTFILESIZE=20000
source /etc/profile.d/conda.sh
# for .bash_history
MY_BASH_BLUE="\033[0;34m"
MY_BASH_CYAN="\e[1;36m"
MY_BASH_NOCOLOR="\033[0m"
HISTTIMEFORMAT=`echo -e ${MY_BASH_CYAN}[%F %T] $MY_BASH_NOCOLOR `
alias a='conda activate'
alias d='conda deactivate'
alias n='nvidia-smi'
alias julab='jupyter-lab'
alias kderestart='kquitapp5 plasmashell || killall plasmashell && kstart5 plasmashell'
alias huserv='hugo server -D'
alias hunew='hugo new'
alias aap='~/Tools/set_headphone_profile_a2dp_sink.sh'
alias hlp='~/Tools/highlight-pointer/highlight-pointer -r 10 --released-color=#E03E3E --pressed-color=#F4DFEB'
alias sai='sudo apt install'
alias gitcl='git clone'
# HSTR configuration - add this to ~/.bashrc
alias hh=hstr # hh to be alias for hstr
export HSTR_CONFIG=hicolor # get more colors
shopt -s histappend # append new history items to .bash_history
export HISTCONTROL=ignorespace # leading space hides commands from history
export HISTFILESIZE=10000 # increase history file size (default is 500)
export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
# ensure synchronization between bash memory and history file
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
# if this is interactive shell, then bind 'kill last command' to Ctrl-x k
if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment