TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Autojump: a cd command that learns

79 pointsby amixabout 15 years ago

13 comments

keyistabout 15 years ago
For those of you who would like similar functionality sans learning of your MFU directories, you can do something like<p>export CDPATH=($HOME/common:$HOME/repos)<p>You'd have to manually symlink your favorite directories into ~/common, of course.<p>The directories listed in $CDPATH are made available to `cd` no matter what directory you are in, so if you have ~/common/downloads, you can type `cd downloads` from any directory. Tab-completion works with this too.<p>Not to downplay autojump -- I just prefer this approach since I explicitly control all the directories I want quick access to, and my `cd` command is deterministic (assuming I name directories to avoid conflicts).
dmdabout 15 years ago
My friend Rupa's 'z' utility - <a href="http://wiki.github.com/rupa/z/" rel="nofollow">http://wiki.github.com/rupa/z/</a> - does this pretty nicely, too.<p>Discussed on reddit here: <a href="http://www.reddit.com/r/programming/comments/7y4ap/where_the_fuck_has_this_been_for_the_last_30/" rel="nofollow">http://www.reddit.com/r/programming/comments/7y4ap/where_the...</a>
评论 #1224513 未加载
评论 #1231264 未加载
akkartikabout 15 years ago
Much nicer than my solution: <a href="http://akkartik.name/bash.html#cd" rel="nofollow">http://akkartik.name/bash.html#cd</a><p><i>Update</i>: Ah, I knew there was another j a year ago: <a href="http://news.ycombinator.com/item?id=485053" rel="nofollow">http://news.ycombinator.com/item?id=485053</a>. (And I pushed my version there as well :/)
amixabout 15 years ago
A patch to autojump that:<p>* Makes it possible to jump to a relative path (e.g. `j ../models`)<p>* Possible to specify multiple patterns, e.g. `j my_project static`<p><a href="http://github.com/amix/autojump/commit/f5fff8d8c0c6e8ce676aadfb8a208d09230ae5fe" rel="nofollow">http://github.com/amix/autojump/commit/f5fff8d8c0c6e8ce676aa...</a>
weilaweiabout 15 years ago
I've also found the CTRL-r shortcut quite helpful in Bash. Most of my commonly used directories and commands are near the surface this way, it works on almost everything without installation, and I'm usually in a directory where those commands would make sense.<p>Although, it doesn't really help if you need to jump to an obscure part of the filesystem.
Luytabout 15 years ago
Back in the 90's I used 4DOS on MS-DOS, which had a similar concept of 'jumping' to a directory by just typing the last part of a directory path. You had to pre-index your directory structure with 'CDD /S', though. And it didn't remember your favourite directories to give them priority.
shabbleabout 15 years ago
I prefer cdargs <a href="http://www.skamphausen.de/cgi-bin/ska/CDargs" rel="nofollow">http://www.skamphausen.de/cgi-bin/ska/CDargs</a><p>it doesn't learn, but rather you create bookmarks with simple aliases. The nicest part is that it's set up so you can tab-complete bookmarks and subsequent subdirs.
评论 #1224583 未加载
philabout 15 years ago
This reminds me of this blog post: <a href="http://unqualified-reservations.blogspot.com/2009/07/wolfram-alpha-and-hubristic-user.html" rel="nofollow">http://unqualified-reservations.blogspot.com/2009/07/wolfram...</a><p>A few extra keystrokes is a good trade to get predictability.
nocmanabout 15 years ago
I wrote my own utility which works a bit differently. Instead of calling cd, I call a different function which changes to a directory stored by an alias in a DBM database. Any time I'm in a directory that I know I'll want to revisit frequently, I call another function to save the current directory (by alias) to the database. Another shell function lists the current aliases in the database and what directories they point to.<p>It's a bit of a hack (a combo of Perl and bash scripting) -- something anyone on HN could probably put together in no time, but it does the job. I've been using it for 2 or 3 years now, and I find it to be extremely useful and a decent time saver.
christefanoabout 15 years ago
Has anyone used this with OS X yet? I installed it manually and haven't been able to get it to work yet.
评论 #1225326 未加载
评论 #1224744 未加载
评论 #1224447 未加载
评论 #1224509 未加载
Pistos2about 15 years ago
I tried autojump (and/or something like it) for a short while, but essentially never found that I never remembered to use it/them. cd, cd -, tab completion, symlinks and screen/tmux are enough for me.
评论 #1225120 未加载
wyclifabout 15 years ago
I've been using autojump for 6 mos. now; it's one of my fave utilities.
hackermomabout 15 years ago
Hm. Is it just me, or does it feel like describing a path with plain ol' tab completion isn't really bothersome, impractical or "a lot of keystrokes"? And since when weren't aliases good enough? I definitely see the use for this under Windows, but in a real nix shell? -shrug-
评论 #1224565 未加载
评论 #1224514 未加载
评论 #1225146 未加载
评论 #1224772 未加载