When bash encounters an unknown command(word?) it does this :
The program 'hello' can be found in the following packages:
* hello
* hello-debhelper
Try: sudo apt-get install <selected package>
what I would like to know is how this is done so I can edit it or add something before it to cross check the unknown word from a home grown dictionary which would have phrase:reply pairs that can then be sent to output.
I am guilty of not looking enough for it around .. but the few bash guides I tried digging up didn't have anything on this. Maybe I am looking at the wrong places .. any pointers?
And yes I am doing this so every time I type wtf when a program fails , I want something nice thrown back at me...
Look in your
/etc/bash.bashrc
for thecommand_not_found_handle
function definition.If you want to remove that behaviour, put this in your .bashrc
If you want to customize, you can do
This might be potentially useful...
The command-not-found package is what gives you the magic response. I'm not sure if it's possible to customize it, but it might be worth a look.
Another option to do what I think what you're trying to do would be to add an alias to your .bashrc file that prints a message whenever you type 'wtf' or something like that:
Add this to your ~/.bashrc file, and then do:
source $HOME/.bashrc
This would then just print a message whenever you type
wtf
into your terminal. You could also make this alias call a script that prints a more detailed message or something similar. The possibilities are endless!This behavior is defined in the system-wide Bash configuration file,
/etc/bash.bashrc
:To customize it, simply override this function in your own
~/.bashrc
:@user606723, if you want to get rid of this behavior in it's entirety:
If that doesn't work, try this:
If you want to get the behavior back: