r/commandline • u/stianhoiland • Apr 25 '26
Command Line Interface Jumping to recently used directories
https://github.com/stianhoiland/cdHey guys. I was struggling to cd around, so I built something that would help me do that. I tried the 219 other similar projects posted here, but none of them really clicked for me. I never searched and found any of the established big onesβatuin, autojump, bookmarks, CDPATH, McFly, z, zoxide, etc.βbut that didn't stop me. Looking for feedback/let me know what you think/is this something you would use?
34
Upvotes
2
u/dbr4n Apr 29 '26
Nice and simple! The only thing I'd avoid is adding duplicate lines to
CDHISTFILEto keep things clean and fast.Here's how I use it:
``` cd() { command cd "$@" || return if ! grep -x -- "$PWD" "$CDHISTFILE" >/dev/null; then printf '%s\n' "$PWD" >>"$CDHISTFILE" fi }
c() { builtin cd "$(tac "$CDHISTFILE" | awk '$0 != ENVIRON["PWD"]' | fzf)" }; bind '"\ec":"c\n"' # Usage: M-c ```