Last Updated: February 25, 2016
·
278
· jacekdominiak

Bash back function

function to quickly navigate file system:

function .. (){
  local arg=${1:-1};
  local dir=""
     while [ $arg -gt 0 ]; do
        dir="../$dir"
        arg=$(($arg - 1));
    done
  cd $dir >&/dev/null
}

You can issue cd .. with
..

with number at the end it will repeat itself n times like so:

.. 3 

which translates to

cd .. ; cd .. ; cd ..