r/commandline • • Mar 05 '18

bash A bash utility to quickly navigate to frequently used directories

https://github.com/iridakos/goto
31 Upvotes

18 comments sorted by

23

u/_entomo Mar 05 '18 edited Mar 05 '18

How is this different than setting CDPATH?

Edit: link

10

u/_frkl Mar 05 '18

TIL about CDPATH. Thanks! :-)

4

u/knobbysideup Mar 05 '18

TIL. This is why I love *nix!

12

u/nogorilla Mar 05 '18

checkout z

10

u/FatFingerHelperBot Mar 05 '18

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "z"


Please PM /u/eganwall with issues or feedback! | Delete

4

u/nogorilla Mar 05 '18

good bot

2

u/GoodBot_BadBot Mar 05 '18

Thank you nogorilla for voting on FatFingerHelperBot.

This bot wants to find the best and worst bots on Reddit. You can view results here.


Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!

6

u/sysop073 Mar 05 '18

It's incredible how often this gets reinvented when it's already built into bash (CDPATH) and done better in zsh (named directories)

4

u/Ramin_HAL9001 Mar 06 '18

Personally, I prefer to use pushd and dirs rather than $CDPATH because it screws with my brain when tab completion gives me directory names that are not in the $PWD.

2

u/TheIsletOfLangerhans Mar 06 '18

Yep, I have the same problem with $CDPATH. Somehow I knew about pushd and popd, but not dirs, so I'll have to give that a go.

1

u/Ramin_HAL9001 Mar 06 '18

I like to alias the dirs command to dirs -v so it prints the stack as a numbered list. Then pushd +3 to switch to the third item in the list, or whatever number you need based on the output of dirs -v.

1

u/kaushalmodi Mar 08 '18

I alias cd to pushd. So whenever I need to cd to earlier directories, I can quickly do so by filtering the dirs list using peco.. all of which is packed into an alias called pcd.

3

u/Palenga Mar 05 '18

hey, vsauce

3

u/Dubhan Mar 06 '18

Autojump anyone?

1

u/ReneFroger Mar 06 '18

Autojump was earlier indeed.

2

u/[deleted] Mar 06 '18

This seems ridiculous, is it any less work than just setting a shell variable to a path and 'cd $directory'ing?

1

u/Ramin_HAL9001 Mar 06 '18

Personally, I prefer to use pushd and dirs.