Files
Lee Hanken 7c8efd2228 Initial commit: HPR Knowledge Base MCP Server
- MCP server with stdio transport for local use
- Search episodes, transcripts, hosts, and series
- 4,511 episodes with metadata and transcripts
- Data loader with in-memory JSON storage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 10:54:13 +00:00

115 lines
10 KiB
Plaintext

Episode: 3836
Title: HPR3836: Using 'zoxide', an alternative to 'cd'
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3836/hpr3836.mp3
Transcribed: 2025-10-25 06:18:31
---
This is Hacker Public Radio Episode 3836 from Monday the 17th of April 2023.
Today's show is entitled, using Soxit as an alternative to CD it is part of the series
Bash scripting. It is hosted by Dave Morris and is about 12 minutes long. It carries an explicit flag.
The summary is, Dave has been using Soxit for a little while and really likes it.
Hello, my name is Dave Morris and this is Hacker Public Radio. Welcome.
Now, today I'm doing a show in a little bit of a hurry. I'm not usually very quick at
doing shows, but we're very, very low. So I'm going to talk about something I've been experimenting
with recently, which is a tool called, I think it's called Zoxide or Zoxide. Not quite sure.
It's a Z-O-X-I-D-E. Anyway, I've not heard anybody else say it. I have no idea. I've been using it
for a few weeks, maybe. I'm not sure how many. Six months, maybe something like that. And learning
about it and seeing how it fits in with me. It's an alternative to the CD command. There are tools
available to do this to remember where you've been and make it easier to jump about from one
place to another in your file system and get back to where you started from and so forth. Ideally,
without having to type out a whole directory, just a piece of it, hopefully, or the end bit of it.
Anyway, I do use pushD and popD for moving in and out of directories from a place where I do
most of my works. I'm working in a top level directory and I want to jump down to a lower directory
and do stuff. And then back again, pushD and popD do that quite nicely. And I did a show on this
ages and ages ago. I've linked to it in the notes. I was using an alternative called AutoJump
for a while last year, but I didn't get on with it. It was mainly because in its memory of which
stretches you'd been in, there was no way of excluding some and I occasionally visit a external
disk and I didn't want it to remember that I'd been there, particularly because it's of no real
interest. So recently I heard of this Zoxide, which as I said, I've been trying for a for a while
and I'm getting to really like it. So what is it? There's a GitHub page, which I've referenced
and it says there, Zoxide is a smarter CD command inspired by something called Z or Z maybe
and AutoJump. I don't actually know what Z is, but other than that of the alphabet,
I didn't bother to look it up to be honest. If I find it, I'll put it in the notes. Anyway,
it remembers which direction you use most frequently so you can jump to them in just a few key strokes.
Zoxide works on all major shells. In the man page relating to this, it's
build as a faster way to navigate your file system and it's written in Rust, so it's pretty quick.
What does it do exactly? Well, it offers the functionality of the Linux and Unix CD command,
but it collects the directions you've visited into a database and gives them a ranking relating
to the number of times you've been there. You visited them. It also applies aging rules and
moves those when the ranking drops below one. It uses something called a free-sensee, I think I say
which is a word made up from the words frequency and recency. There's a Wikipedia page explaining it
and it's something from computer science. You can get the general gist of what's going on there,
I think. It performs algorithmic matching on the directory specifies, so it doesn't have to be
an exact name. It can be a part of a name and there are various shortenings and so forth. You can
read up about the algorithm it uses and it takes you to the highest ranking best match. It can resolve
conflicts between matching directories or can allow selection through an interactive interface.
So if you've got two directories which end with the same name and you know which one you want,
but the Zoxi doesn't, you can get it to offer you a list of all the matches. It doesn't do that
by default, so as I'm aware, but you can get it to do that and then choose one from it. It can also
interface to another tool called FZF, a general purpose command line fuzzy finder which I'd
heard of never used and I've installed it with Zoxide and just to give you the hint that how does
it know which directory you're in? Well in the context of bash and there's other ways of doing it
and there's other other shells that it will work with as I've mentioned. It uses in bash the prompt
command variable. This is a variable that contains one or more commands. It can be a simple variable
or an array and it will execute whatever commands it finds going through the whole array if necessary.
And it does that before displaying the prompt for a new command. This is used in all sorts of
contexts. People are doing fancy things with their prompts and so on, often use this to get
information about stuff they need for the prompt and it's a common way to hook monitoring commands
into a bash session. What was the oven called? Auto jump did something similar and I've got various
other tools that hook into this. So it's quite a cool way of doing it. I just thought you might
be interested to know how it does that. So how do you set it up? Well it's shell specific
and I run bash so I've added it to my bash rc by adding the command and the command is a vowel
then in double quotes dollar open bracket Zoxide init bash close bracket closed all quotes. Not
that doing is it's running a command substitution in a string which is called Zoxide with the
arguments init and bash which init means do initiate initialization stuff and it needs to know
which shell you want it for. So that's what bash does. An eval is a bash command which will
evaluate whatever comes out of an expression like this as commands in the in the current context.
So there you go it will have done things like it's it creates a function which is it just
consists of the single letter Z and that's just a shorthand way of invoking Zoxide. It doesn't have
the full functionality of the full length command but it'll it's great for just zooming around the
place. It's also a function Z i which lists all of the stored directories and it uses FZF to do this.
Now I haven't tested this without FZF so I'm not sure what it does if you haven't installed that.
The scrollable list that you get can be navigated in a directory chosen by pressing Enter or with a
double mouse click. So in the scrollable list if characters are tight there's a sort of prompt at
the bottom of the list. I think you can organize where that is in fact but say it's the bottom of
the default. If you type stuff there then those I use to match directories in the list so you can
have quite a long list and then type stuff and gradually the list shrinks as you add letters to
to the prompt until hopefully you end up with the one you wanted and this is fantastic if you've
forgotten exactly how you named a directory but you know approximately how how you did it.
So you can tune this you might expect so you can modify its behavior through environment variables
and you can also change it when you call the init variant but I won't go into this that particular
bit. So for example you can define directories which are not to be stored in the database using
an environment variable which is called underscore and all in uppercase z0 underscore exclude underscore
doors and you've got to do this before running Zoxide init. In my case I have the following in my
bash rc which is export underscore z0 underscore exclude doors equals and then I put in quotes slash
media slash extras colon and then slash media slash extras slash star asterisk close quotes and
that comes before the eval that I mentioned before. So that means that the particular directories
which is the the disc that I have with various odds and odds in it which I don't really want to
be cluttering up my directory stuff the database of directories I should say. There's lots more
details about this in the GitHub documentation. So the documentation is really good and I've linked
to the GitHub page in several places in the notes and also I've linked to the FZF GitHub page.
So I actually installed Zoxide from the Debian testing repository but that mean I got a version
which is not not very recent 090 is the latest and I got 0.4.3 which not ideal you can install it
from the GitHub page and there's an install script you can simply download with co and pipe to
bash. I'm never too comfortable about doing this but you can do that. I think I might do that
at some stage and what you get is a binary so you don't have to build it because building rust can
be a little convoluted. I also installed FZF from the Debian testing repo. This is an extraordinarily
powerful tool. The man page itself is giant but yeah I haven't really spent much time learning
what it can do. I think it can search through your command history and file system and all this
sort of stuff. Looks amazing. So my conclusion about Zoxide or Zoxide or Zoxide or whatever it's
called is I really like it. It's fast and configurable and with FZF gives some great command line
features. There are editor plug-ins as well such as Zoxide.vim for Vim and NeoVim. I haven't
tried that yet. It also integrates other third party tools. Just out of interest if you're
KDE user like I am and use Dolphin a lot then the hooks that watch which directly you're in
triggered by Dolphin as well not too surprisingly. So you will get a benefit from it there as well.
I don't know if there's an interface to Dolphin. That would be really cool. So you could
you can get to places without knowing too much about where they are but if it's not there yet
it probably will arrive at some point or other. So I would say this seems to be the best
enhanced CD look like. It's type so I would strongly recommend it. Okay that's it. Bye.
You have been listening to Hacker Public Radio at Hacker Public Radio. Does it work?
Today's show was contributed by a HBR listener like yourself. If you ever thought of recording
or cast, you can click on our contribute link to find out how easy it means. Hosting for HBR has
been kindly provided by an onsthost.com, the internet archive and our sings.net. On the Sadois
stages, today's show is released on their creative commons, attribution, 4.0 International