Question: If I need to change to some directory several levels up, I usually do this in bash:

```
cd ../../../../some/other/folder

```

Since it is quite annoying to type all those periods and slashes, I was wondering if there is some shorter way to type it; like for example:

```
cd ..4/some/other/folder

```

I have not been able to find it so far from for example `cd --help`.

Answer: 
There's no standard way.

You can declare a function that takes a number of parent directories as the first argument, and the relative path as the second one:

```
cdu () {
    local n=$1
    local p=""
    while ((n--)) ; do
        p+=../
    done
    cd "$p/$2"
}

```

You can then shorten `cd ../../../bin` to `cdu 3 bin`

What I use is

```
alias ..='cd ..'
alias ...='cd ../..'

```

To get 6 levels up, I just type `...` + `Enter` three times.
according to cd man page, the immediate answer is "no".

if it helps, you may add the following to your .bashrc:

```
export prev1=".."
export prev2="../.."
export prev3="../../.."
export prev4="../../../.."

```

and so on.

example:

```
export prev4="../../../.."
mkdir -p /1/2/3/4/5
cd /1/2/3/4/5
pwd => result is /1/2/3/4/5
cd $prev4
pwd => result is /1

```