Thursday, April 4, 2013

Excerpt of my .bashrc file

Misspelling aliases are probably the most useful feature!
# aliases for terminal use
alias ls='ls --color'
alias ll='ls -lh'
alias la='ls -lha'


# protection against ninja (and stupid) "rm"
alias rm='mv $1 ~/trash/'

# aliases for misspelling
alias mroe='more'
alias nore='more'
alias mero='more'

alias enacs='emacs'
alias emacxs='emacs'

# aliases for separator

alias cut='cut -d "|"'
alias awk='awk -F "|"'

# alias for navigation
alias mor='cd /data/$USER'

# variables for navigation
UMLS2012AB='/export/home/$USER/data/umls/2012AB/META/'

 # line prefix
PS1='$USER@$HOST:\W $'

# mask to correct rights for file creation
umask 0022

# functions
function emacs() { command emacs -name "$@" "$@" & }
function firefox() { command firefox "$@" & }
extract () {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2)    tar xjf $1        ;;
            *.tar.gz)    tar xzf $1        ;;
            *.bz2)        bunzip2 $1        ;;
            *.rar)        rar x $1        ;;
            *.gz)        gunzip $1        ;;
            *.tar)        tar xf $1        ;;
            *.tbz2)        tar xjf $1        ;;
            *.tgz)        tar xzf $1        ;;
            *.zip)        unzip $1        ;;
            *.Z)        uncompress $1    ;;
            *)            echo "'$1' cannot be extracted via extract()" ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}

# manage history
export HISTCONTROL=ignoredups:erasedups  # no duplicate entries
export HISTSIZE=100000                                  # big big history
export HISTFILESIZE=100000                          # big big history
shopt -s histappend                                             # append to history, don't overwrite it

# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

No comments:

Post a Comment