7 ms·
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'
by ktm5j 8mo 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.
- aflag 8mo agoI thought Ubuntu did that, but not Debian. Still, that's very different than what the author mentioned
- ktm5j 8mo agoOh 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.
- dataflow 8mo agoIt's https://packages.debian.org/sid/command-not-found https://packages.debian.org/sid/command-not-found
- ktm5j 8mo agowhich 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
- VorpalWay 8mo agoThis 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-command-not-found-handler/ https://vorpal.se/posts/2025/mar/25/filkoll-the-fastest-comm...
- zahlman 8mo agoI thought of that, but TFA describes a system that trips on incorrect filenames rather than just incorrect commands.
- VorpalWay 8mo agoI vaguely remember that there are hook functions for processing all entered lines as well (at least for zsh), but it isn't something I have used myself so I know nothing more than that.
- bandrami 8mo agocachy's setup of fish tries to suggest commands (and even arguments) it might be, which I find terrifying and so turn off.