Remix.run Logo
ktm5j 11 hours ago

I'm on my phone so I'm too lazy to dig for this, but I'm pretty sure they're talking about the bit of shell script that gets run if you type a command that isn't found in PATH.

Fedora and Debian will both dive straight into searching apt/dnf for a matching package and ask "do you want to install this?"

I imagine you could create a hook that gets run for any command failure, but again I'm on my phone so not sure.

VorpalWay 11 hours ago | parent | next [-]

This is generally called a command-not-found handler and are a feature of all the major shells (though the exact details differ, the general idea is to define a function with a specific reserved name), and most majors distros have ones that can be installed, even if they aren't by default.

I wrote my own (much faster) such handler for Arch Linux. I even wrote a blog post about the design: https://vorpal.se/posts/2025/mar/25/filkoll-the-fastest-comm...

zahlman 4 hours ago | parent [-]

I thought of that, but TFA describes a system that trips on incorrect filenames rather than just incorrect commands.

dataflow 11 hours ago | parent | prev | next [-]

It's https://packages.debian.org/sid/command-not-found

ktm5j 11 hours ago | parent [-]

which is run by bash in the way I described.

In /etc/bash.bashrc:

# if the command-not-found package is installed, use it if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then ... fi

aflag 11 hours ago | parent | prev | next [-]

I thought Ubuntu did that, but not Debian. Still, that's very different than what the author mentioned

ktm5j 11 hours ago | parent [-]

Oh you might be right about Ubuntu vs Debian.. but I'm right about everything else I said. I went and looked at the source code.

bandrami 4 hours ago | parent | prev [-]

cachy's setup of fish tries to suggest commands (and even arguments) it might be, which I find terrifying and so turn off.