`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
$ .. /
/
$
Written by Josh Graham
Related protips
1 Response
useful, thnx
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#