Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aont/c3040b0b340a91565ae5d309b9220a87 to your computer and use it in GitHub Desktop.

Select an option

Save aont/c3040b0b340a91565ae5d309b9220a87 to your computer and use it in GitHub Desktop.

Disable Extra Suggestions on Mistyped Commands in Bash

When you run:

unset -f command_not_found_handle

you are removing Bash’s special function that normally catches typos or missing commands.

By default on Ubuntu (and some other distros), this function doesn’t just show a plain error — it also tries to query the package system (like APT) to suggest which package might provide that command.

Unsetting the function disables this behavior, so Bash will only display the simple error message:

bash: somecommand: command not found

👉 In short: this command turns off the “helpful but sometimes annoying” package search and keeps things clean when you mistype.

Would you like me to also show you how to make this permanent (so you don’t need to run it in every new shell)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment