On Debian 13 how to make:

```bash
josm
```
```
bash: josm: command not found
```

become automatically:

```bash
josm
```
```
Command 'josm' not found, but can be installed with:
sudo apt install josm
sudo apt install josm-installer
```

?
Jul 8, 12:24pm

On Debian (and most Linux distributions), the behavior you want—where the shell suggests installing a package when a command is not found—is provided by the command-not-found package.

How to Enable This on Debian 13

  1. Install the command-not-found package:

    bash
    sudo apt update
    sudo apt install command-not-found
  2. Enable the feature: The command-not-found package is usually enabled by default after installation. If not, ensure your shell (e.g., bash or zsh) sources the /etc/bash_command_not_found script. For bash, this is typically handled in /etc/bash.bashrc or /etc/profile.d/command-not-found.sh.

  3. Restart your shell or open a new terminal.

  4. Test it: Run josm again. If the package is available in the repositories, you should see the suggestion to install it.


If It Still Doesn’t Work

  • Check if the package is in the repositories: Run apt search josm to confirm the package exists.

  • Manually source the script: If the feature is not enabled automatically, add this line to your ~/.bashrc or ~/.zshrc:

    bash
    source /etc/bash_command_not_found

    Then reload your shell:

    bash
    source ~/.bashrc
  • For zsh users: Ensure the command-not-found plugin is enabled in your zsh configuration.


Jul 8, 12:24pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more