In a bash shell, if you put some command that is not installed on your system, it throws an error and also gives you a package installation suggestion. For example-
$ iostat
Command 'iostat' not found, but can be installed with:
sudo apt install sysstat
My personal favorite is tcsh but it does not give any package installation suggestion while some command is not found. How can I get the package installation suggestion (like bash) in tcsh?
The magic works because of
command_not_found
package that provide acommand_not_found_handle
function for both bash and zsh.This works in bash because of this snippet in
/etc/bash.bashrc
There is also a file
/etc/zsh_command_not_found
that you can source to get that behavior for zsh - here, the function is calledcommand_not_found_handler
.From a quick search, it does not seem that tcsh include such a functionnality to define a
command_not_found_handle
. So may be the name, is different, in that case you just need to convert the snippet in tcsh and include it in your~/.tcshrc
, else you can't!