CRUMBS! Commandline navigation tool for Powershell

Penfold from Dangermouse and the word Crumbs!

I live on the commandline as much as possible (which is not nearly enough) and hence spend a lot of time navigating from one place to another. But, as much time as I spend navigating, I spend considerably more time thinking about ways to improve it.

One tool I've come up with is a set of functions that I call:


* Pronounced "CRUMBS!" in the voice of Penfold from Dangermouse. (I realize that my American readers are probably unfamiliar with concepts like "Penfold" and "Dangermouse" so I'll give you a few minutes to look up those concepts, watch a few episodes on the YouTube, learn about The Goodies while you're there, etc.)

download crumbs.ps1 (dot it)

crumbs at github

To use it, download it, open powershell and 'dot' the file, i.e. execute: ". .\crumbs.ps1"

Crumbs consists of two functions: crumb and crumbs. It borrows a metaphor from the story of Hansel and Gretel. You may recall that they dropped breadcrumbs in order to find their way back. Although in this case the breadcrumbs are more like transwarp teleportation wormholes that let you zing across space and time. And there's no birds that eat the crumbs nor are there any gingerbread houses or cannibalistic witches. But I digress.

Here's how you use the two functions.

Let us say that you're in some deeply nested folder which you might want to get back to. Use the crumb command to drop a crumb:

PS C:\Work\Scratch\Pyjamas\Carousel Fandango\Rhubarb\> crumb

There. You dropped a crumb and now you'll be able to get back to that location. Let's go somewhere else...

PS C:\Work\Scratch\Pyjamas\Carousel Fandango\Rhubarb\> cd C:\Play\Games
PS C:\Play\Games> crumbs
0 -> C:\Work\Scratch\Pyjamas\Carousel Fandango\Rhubarb
PS C:\Play\Games> crumb
PS C:\Play\Games> crumbs
0 -> C:\Work\Scratch\Pyjamas\Carousel Fandango\Rhubarb
1 -> C:\Play\Games

Did you see that? When we called the crumbs command, it listed allllll of our crumbs... (we happened to only have one crumb) and it said that the id for that crumb was number zero. Then we added another crumb and saw it was number 1 in the list of crumbs.

Now if we type "crumb 0" we'll jump straight back to that location...

PS C:\Play\Games> crumb 0
PS C:\Work\Scratch\Pyjamas\Carousel Fandango\Rhubarb\> 

That's pretty much it. You can drop as many crumbs as you like... well up to int.max of them I guess. And you can remove them by "minusing" them away, like so:

PS C:\Play\Games> crumb -0

(Crumb 0 deleted)

Crumbs only live for the duration of your console session. I had an idea about making a 'bake' command that would make a crumb permanent (by turning it into a 'crouton') -- but either the metaphor was stretched too far or I got hungry and went off to eat. Whatever the cause, I never got as far as the bake command.

Included in the script above are aliases, that let you type 'cr' instead of 'crumb' and 'crs' instead of 'crumbs'.

And while you're at it, go buy a Penfold 'CRUMBS!' sticker, as seen above.

Navigation in Other Worlds

Meanwhile, in the bash world they have some very cool tools to make navigating easier. In particular several tools such as autojump, z, v and fasd use the concept of 'frecency' (the combination of frequency and recency) combined with auto-completion to let you find your most likely next location in as few keystrokes as possible. Are there equivalents in Powershell? Seen one? Got one? I've just found "Jump-location" and plan to give it a spin.

Also, in the last few days I came across an approach that is not too different to crumbs Mark and Jump. There was a lengthy related discussion at hacker news.

I've implemented my own version of this as well.

download markjump.ps1 (dot it)

markjump at github

In this case there are four functions: Mark, Jump, Unmark and Marks.

With 'mark' (unlike crumb) you specify a friendly name for the current location. Then with Jump {name} you go back to it. Use marks to list all the names and locations you've marked. And with unmark {name} you can remove one from the list. (Go read the readme if you really care.)

It includes aliases 'm' for mark, 'j' for jump, and um for unmark. You might want to comment those out if they collide with other aliases you use.

Crumbs is useful for adhoc navigation tasks. Marks is useful for links you use often. (It persists across your sessions). Both are useful. Both are a bit raw. Feedback welcome.


My book "Choose Your First Product" is available now.

It gives you 4 easy steps to find and validate a humble product idea.

Learn more.

(By the way, I read every comment and often respond.)

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.