Em geral
O Linux Journal tem um artigo muito bom:
Da página de man do bash:
... A full search of the directories in PATH is performed only if the command is not found in the hash table. If the search is unsuccessful, the shell searches for a defined shell function named command_not_found_handle. If that function exists, it is invoked with the original command and the original command's arguments as its arguments, and the function's exit status becomes the exit status of the shell. If that function is not defined, the shell prints an error message and returns an exit status of 127.
e
A quick grep in /etc discovered where it was happening. The function itself is in /etc/bash_command_not_found and that function gets included (if it exists) in your bash session via /etc/bash.bashrc.
Ubuntu 14.04
Evidências empíricas sugerem que em uma instalação do Ubuntu 14.04, o arquivo / etc / bash_command_not_found não existe, entretanto, o arquivo correto é um script python, localizado em / usr / lib / command-not-found