====== Normal Aliases ====== ==== Cleaning up ==== This is useful, if you want to remove systemwide aliases from your config: # Clean up unwanted system aliases and start from scratch. unhash -am '*' ==== Common Aliases ==== # fast directory change alias ...='cd ../..' alias ....='cd ../../..' alias .....='cd ../../../..' alias ......='cd ../../../../..' alias .......='cd ../../../../../..' # upgrade shortcut for debian users [ -r /etc/debian_version ] && [ -x `which sudo` ] && alias upgrade='sudo apt-get update && sudo apt-get -u upgrade' # vared variant which splits arrays onto separate lines alias lvared="IFS=\$'\n' vared" # After some commands, it is useful to avoid filename generation: for com in alias expr find mattrib mcopy mdir mdel which ; do alias $com="noglob $com" ; done # editing the last (newest file) in a directory ## HOWITWORKS: ## (. matches plain files, ^D disables the GLOB_DOTS option ## (no dot-files are included), om sorts the files by modification date, ## [1] selects the first of them.) alias vil='vi *(.om[1]^D)' # Very often I want to see a bunch of history entries instead of simply searching back: alias hg='fc -l 0|grep' # Remove trash alias rmold='rm -vf .*~ *~ \#*\#' # verbose, ignore errors and don't ask. alias rmtex='rm -vf .*~ *~ *log *.nav *.snm *.toc *.cp *.fn *.tp *.vr *.pg *.ky \#* *blg *ilg *.dvi *.aux;\ rm -vfr ./auto/' alias rmps='rm -vf *.ps' ==== grep ==== Checking for options before setting them. Some Linux dists (Debian) will ship grep without support for perl regexp, so it's good to check it before setting it: # GREP if [[ 0 -eq `echo $SHELL|grep --perl-regexp sh &>/dev/null; echo $?` ]] then GRP='--perl-regexp' else GRP='--extended-regexp' fi if [[ 1 -eq `grep --help|grep --count color` ]] then GRP='--color=auto '$GRP ;fi alias grep='grep --ignore-case '$GRP unset GRP