title: The 'command not found' handler tags: #bash #command-not-found See [this askubuntu question](https://askubuntu.com/questions/1464106/command-not-found-handler/1464110#1464110). In summary: ```bash declare -f -p command_not_found_handle ``` yields ```bash command_not_found_handle () { if [ -x /usr/lib/command-not-found ]; then /usr/lib/command-not-found -- "$1"; return $?; else if [ -x /usr/share/command-not-found/command-not-found ]; then /usr/share/command-not-found/command-not-found -- "$1"; return $?; else printf "%s: command not found\n" "$1" 1>&2; return 127; fi; fi } ``` and you can override this to whatever you like.