Skip to content

Instantly share code, notes, and snippets.

@fabioam
Last active February 3, 2018 21:43
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 fabioam/b68ab36bcbfa17023b247bfef72d6d8c to your computer and use it in GitHub Desktop.
Save fabioam/b68ab36bcbfa17023b247bfef72d6d8c to your computer and use it in GitHub Desktop.
bashrc with some alias and functions
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
[[ -f ~/.extend.bashrc ]] && . ~/.extend.bashrc
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
VBOX_USB=usbfs
## Colorize the ls output ##
alias ls='ls --color=auto'
alias l='ls --color=auto'
## Use a long listing format ##
alias ll='ls -la'
## Show hidden files ##
alias l.='ls -d .* --color=auto'
## get rid of command not found ##
alias cd..='cd ..'
## a quick way to get out of current directory ##
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
# Create parent directories on demand
alias mkdir='mkdir -pv'
function gri { grep -rnIi "$1" . --color; }
function gr { grep -rnI "$1" . --color; }
function ff { find . -name "$1"; }
function ffi { find . -iname "$1"; }
alias e='subl'
alias s='subl'
export PATH=$PATH:/home/czd/Documents/bin
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv2
export WORKON_HOME=~/.virtualenvs
source /usr/bin/virtualenvwrapper.sh
alias vi='vim'
alias top='htop'
GIT_PROMPT_ONLY_IN_REPO=1
source ~/.bash-git-prompt/gitprompt.sh
function ffv { vi `find . -name "$1"`; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment