Skip to content

Instantly share code, notes, and snippets.

@josephbolus
Created July 4, 2024 20:10
Show Gist options
  • Save josephbolus/25876fb3ca4089da7352f5b44516de77 to your computer and use it in GitHub Desktop.
Save josephbolus/25876fb3ca4089da7352f5b44516de77 to your computer and use it in GitHub Desktop.
Small scripts, hacks and automations.

This is more in the "hack" category, but here is a solution for bookmarking directories[1] that I am quite fond of:

mkdir -p ~/.marks/
export CDPATH=.:~/.marks/
function mark { ln -sr "$(pwd)" ~/.marks/"$1"; }

Then:

  • mark @name # add bookmark called @name for the current directory
  • cd @name # jump to the bookmarked location
  • cd @ # list all available bookmarks

It can list bookmarks, auto-complete, jump to sub-directories within bookmarks, all without introducing any new commands - just cd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment