alias gogit='cd /var/www/git/' alias gowww='cd /var/www/' gg () { cd /var/www/git/ && cd "$@" && git st } _git_add_complete() { COMPREPLY+=( $( ls /var/www/git/ | grep "$2" ) ) } complete -F _git_add_complete gg xmlpretty() { local ORIGINAL=$1 local FILENAME=${ORIGINAL%.xml} local FINAL=${FILENAME##*/} xmllint --format "$1" --output ${FINAL}.pretty.xml } function extract() { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xvjf $1 ;; *.tar.gz) tar xvzf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) unrar x $1 ;; *.gz) gunzip $1 ;; *.tar) tar xvf $1 ;; *.tbz2) tar xvjf $1 ;; *.tgz) tar xvzf $1 ;; *.zip) unzip $1 ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "'$1' cannot be extracted via >extract<" ;; esac else echo "'$1' is not a valid file!" fi } # Creates an archive (*.tar.gz) from given directory. function maketar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; } # Create a ZIP archive of a file or folder. function makezip() { zip -r "${1%%/}.zip" "$1" ; } function my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,bsdtime,command ; } function pp() { my_ps f | awk '!/awk/ && $0~var' var=${1:-".*"} ; } function dataurl() { local mimeType=$(file -b --mime-type "$1") if [[ $mimeType == text/* ]]; then mimeType="${mimeType};charset=utf-8" fi echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')" } shopt -s cdspell # autocorrects cd misspellings shopt -s checkwinsize # update the value of LINES and COLUMNS after each command if altered date