Useful bash functions I

Put the following in your ~/.bashrc

up() {
    if [ $# == 0 ]
    then
        cd ..
        return
    fi
    if [ "${1//[^0-9]/}" != "$1" ]
    then
        echo "Not a number"
        return
    fi
    STRING=""
    for (( i=0; i<$1 ; i++ ))
    do
        STRING="$STRING../"
    done
    cd $STRING
}

up is equivalent to cd .. and up N jumps up N directories in the directory tree.