Last Updated: February 25, 2016
·
712
· delitescere

`cd ..` with less fuss

Have you been deep in a directory structure and wanted to jump up several parents with less typing?

Rather than the clumsy cd ../../../.., add the code in this gist to your ~/.bashrc flow:

https://gist.github.com/delitescere/f20461025d4e4e663e19

Usage: .. [count|name|-|/]

Type .. 4 at the prompt if you want to jump up 4 directories. It defaults to 1 if you don't specify a number.

Type .. name at the prompt to jump to a parent directory called "name". If there isn't one, it won't jump.

Type .. - at the prompt to go to the previous directory (same as cd -).

Type .. / at the prompt to jump straight to root.

Example use:

$ pwd
/Users/josh/Code/canva/infrastructure/terraform
$ .. 4
/Users/josh
$ cd -
/Users/josh/Code/canva/infrastructure/terraform
$ ..
/Users/josh/Code/canva/infrastructure
$ .. -
/Users/josh/Code/canva/infrastructure/terraform
$ .. josh
/Users/josh
$ .. wat
$ .. /
/
$ 

1 Response
Add your response

useful, thnx

over 1 year ago ·