Skip to content

Instantly share code, notes, and snippets.

@bootandy
Last active May 16, 2018 13:39
Show Gist options
  • Save bootandy/3776489 to your computer and use it in GitHub Desktop.
Save bootandy/3776489 to your computer and use it in GitHub Desktop.
My .bash_aliases file for ubuntu
# colors
export CLICOLOR=1
export TERM=xterm-color
export LSCOLORS=gxgxcxdxbxegedabagacad # cyan directories
# We use UK keyboard
setxkbmap -layout gb
set completion-prefix-display-length 2
set completion-ignore-case on
# 1 TAB not 2 to list options
set show-all-if-ambiguous on
set show-all-if-unmodified on
# old Prompt
#export PS1='\[\033[01;32m\]\u@:\[\033[01;36m\]\w\[\033[00m\]\$ '
#Android sdk add to PATH
#PATH=$PATH:/System/Library/android-sdk-mac_x86/tools/
#Giant history
export HISTSIZE=99999999
alias l='ls -alF'
alias 'ps?'='ps ax | grep '
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# grc from http://korpus.juls.savba.sk/~garabik/software/grc.html
alias gtail='grc tail'
alias l='ls -alF'
alias open='xdg-open'
alias gs="git status"
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gb="git branch"
alias gp="git push"
# password memory
git config --global credential.helper cache
alias gitpass='eval "$(ssh-agent -s)"; ssh-add ~/.ssh/id_rsa'
echo "To remember git password type: gitpass"
# virtual env wrapper:
export WORKON_HOME=~/dev/envs/
source /usr/local/bin/virtualenvwrapper.sh
alias cgrep="egrep --color=always"
function git_branch() {
git branch &>/dev/null; if [ $? -eq 0 ]; then echo " ($(git branch | grep ^* |sed s/\*\ //))"; fi
}
function print_v_env() {
if [ ! -z $VIRTUAL_ENV ]; then
echo $VIRTUAL_ENV|awk -F'/' '{print "("$NF")"}'
fi
}
#prompt changes color if last command failed
function exitstatus {
EXITSTATUS="$?"
BOLD="\[\033[1m\]"
RED="\[\033[1;31m\]"
GREEN="\[\e[32;1m\]"
BLUE="\[\e[34;1m\]"
CYAN="\[\033[01;36m\]"
OFF="\[\033[m\]"
PRE="$(print_v_env)$(git_branch)"
PROMPT="\u:${CYAN}(\j):\w"
if [ "${EXITSTATUS}" -eq 0 ]
then
export PS1="${PRE}${GREEN}${PROMPT}${OFF}\$${OFF} "
else
export PS1="${PRE}${RED}${PROMPT}${RED}\$${OFF} "
fi
PS2="${BOLD}>${OFF} "
}
PROMPT_COMMAND=exitstatus
#export PS1='\[\033[01;32m\]\u@:\[\033[01;36m\]\w\[\033[00m\]\$ '
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
#Set numlock to ON
numlockx&
# save commands in history:
shopt -s histappend
PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
# Git use vim
export GIT_EDITOR=vim
export VISUAL=vim
export EDITOR=vim
# ssh key memory
alias remember="ssh-add ~/.ssh/id_rsa"
#learn linux time:
echo "----------------------------"
echo "Did you know that: try ? for more"; whatis $(ls /bin | shuf -n 1)
alias ?='cowsay -f $(ls /usr/share/cowsay/cows | shuf -n 1 | cut -d. -f1) $(whatis $(ls /bin) 2>/dev/null | shuf -n 1)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment