Command not found message [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2
















This question already has an answer here:



  • No command 'bla' found, did you mean:?

    3 answers



When running invalid commands without any parameters or options, in my experience we get only two kinds of messages which are exemplified below:



~$ Date
No command 'Date' found, did you mean:
Command 'yate' from package 'yate' (universe)
Command 'date' from package 'coreutils' (main)
Command 'late' from package 'late' (universe)
Command 'kate' from package 'kate' (universe)
Date: command not found
~$ fjldjflsk
fjldjflsk: command not found
~$


I'm interested in knowing more about how this works. Specifically, when can I know which of these two kinds of messages I'm going to get prior to running the command? Is there some kind of environment variable or any other device that would allow me to alter this behavior easily? I'd like to get only the second kind of message.










share|improve this question















marked as duplicate by Olorin, Sparhawk, Mr Shunz, Jeff Schaller, jsbillings Feb 18 at 14:01


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    You are on Linux. Which variant? You want to remove the predictions?

    – Kusalananda
    Feb 17 at 21:58












  • @Kusalananda Actually the code above was ran in WSL - Ubuntu, but I'd like to know how to deal with this in regular Ubuntu. If it matters the shell is Bash.

    – command_not_found
    Feb 17 at 22:05















2
















This question already has an answer here:



  • No command 'bla' found, did you mean:?

    3 answers



When running invalid commands without any parameters or options, in my experience we get only two kinds of messages which are exemplified below:



~$ Date
No command 'Date' found, did you mean:
Command 'yate' from package 'yate' (universe)
Command 'date' from package 'coreutils' (main)
Command 'late' from package 'late' (universe)
Command 'kate' from package 'kate' (universe)
Date: command not found
~$ fjldjflsk
fjldjflsk: command not found
~$


I'm interested in knowing more about how this works. Specifically, when can I know which of these two kinds of messages I'm going to get prior to running the command? Is there some kind of environment variable or any other device that would allow me to alter this behavior easily? I'd like to get only the second kind of message.










share|improve this question















marked as duplicate by Olorin, Sparhawk, Mr Shunz, Jeff Schaller, jsbillings Feb 18 at 14:01


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    You are on Linux. Which variant? You want to remove the predictions?

    – Kusalananda
    Feb 17 at 21:58












  • @Kusalananda Actually the code above was ran in WSL - Ubuntu, but I'd like to know how to deal with this in regular Ubuntu. If it matters the shell is Bash.

    – command_not_found
    Feb 17 at 22:05













2












2








2


1







This question already has an answer here:



  • No command 'bla' found, did you mean:?

    3 answers



When running invalid commands without any parameters or options, in my experience we get only two kinds of messages which are exemplified below:



~$ Date
No command 'Date' found, did you mean:
Command 'yate' from package 'yate' (universe)
Command 'date' from package 'coreutils' (main)
Command 'late' from package 'late' (universe)
Command 'kate' from package 'kate' (universe)
Date: command not found
~$ fjldjflsk
fjldjflsk: command not found
~$


I'm interested in knowing more about how this works. Specifically, when can I know which of these two kinds of messages I'm going to get prior to running the command? Is there some kind of environment variable or any other device that would allow me to alter this behavior easily? I'd like to get only the second kind of message.










share|improve this question

















This question already has an answer here:



  • No command 'bla' found, did you mean:?

    3 answers



When running invalid commands without any parameters or options, in my experience we get only two kinds of messages which are exemplified below:



~$ Date
No command 'Date' found, did you mean:
Command 'yate' from package 'yate' (universe)
Command 'date' from package 'coreutils' (main)
Command 'late' from package 'late' (universe)
Command 'kate' from package 'kate' (universe)
Date: command not found
~$ fjldjflsk
fjldjflsk: command not found
~$


I'm interested in knowing more about how this works. Specifically, when can I know which of these two kinds of messages I'm going to get prior to running the command? Is there some kind of environment variable or any other device that would allow me to alter this behavior easily? I'd like to get only the second kind of message.





This question already has an answer here:



  • No command 'bla' found, did you mean:?

    3 answers







shell command command-not-found






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 17 at 22:01









Kusalananda

135k17255422




135k17255422










asked Feb 17 at 21:53









command_not_foundcommand_not_found

132




132




marked as duplicate by Olorin, Sparhawk, Mr Shunz, Jeff Schaller, jsbillings Feb 18 at 14:01


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Olorin, Sparhawk, Mr Shunz, Jeff Schaller, jsbillings Feb 18 at 14:01


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1





    You are on Linux. Which variant? You want to remove the predictions?

    – Kusalananda
    Feb 17 at 21:58












  • @Kusalananda Actually the code above was ran in WSL - Ubuntu, but I'd like to know how to deal with this in regular Ubuntu. If it matters the shell is Bash.

    – command_not_found
    Feb 17 at 22:05












  • 1





    You are on Linux. Which variant? You want to remove the predictions?

    – Kusalananda
    Feb 17 at 21:58












  • @Kusalananda Actually the code above was ran in WSL - Ubuntu, but I'd like to know how to deal with this in regular Ubuntu. If it matters the shell is Bash.

    – command_not_found
    Feb 17 at 22:05







1




1





You are on Linux. Which variant? You want to remove the predictions?

– Kusalananda
Feb 17 at 21:58






You are on Linux. Which variant? You want to remove the predictions?

– Kusalananda
Feb 17 at 21:58














@Kusalananda Actually the code above was ran in WSL - Ubuntu, but I'd like to know how to deal with this in regular Ubuntu. If it matters the shell is Bash.

– command_not_found
Feb 17 at 22:05





@Kusalananda Actually the code above was ran in WSL - Ubuntu, but I'd like to know how to deal with this in regular Ubuntu. If it matters the shell is Bash.

– command_not_found
Feb 17 at 22:05










1 Answer
1






active

oldest

votes


















2














The bash shell calls a function called command_not_found_handle whenever a command is not found.



This function can be viewed with declare -f command_not_found_handle and may look something like this (found on an Ubuntu system):



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 foundn" "$1" 1>&2;
return 127;
fi;
fi



As you can see, it uses some other tools called command-not-found.



To remove the predictions that this function makes, you can either remove this function altogether using



unset -f command_not_found_handle


(this is probably the best option) or, you can uninstall the executable that the function uses, assuming a system using apt:



sudo apt purge command-not-found


(the command-not-found command is part of the package of the same name on e.g. Ubuntu at least).



For more information about the command_not_found_handle function, see the bash manual.






share|improve this answer

























  • Perfect! Thanks.

    – command_not_found
    Feb 17 at 22:11











  • Hmm, I just did the unset command and ran the same command only with set instead of unset, but didn't retrieve the functionality. Do I see to restart my shell? (I'd rather not at the moment).

    – command_not_found
    Feb 17 at 22:25











  • @command_not_found You could try source /etc/bash.bashrc (or whatever the equivalent file is called on your system). On the Ubuntu machine I have access to, that file sets up the command_not_found_handle function.

    – Kusalananda
    Feb 17 at 22:32











  • It worked. Thanks.

    – command_not_found
    Feb 17 at 22:35











  • It does not have to be a Linux, to run apt (E.g. Ubuntu on WSL).

    – ctrl-alt-delor
    Feb 17 at 23:21

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














The bash shell calls a function called command_not_found_handle whenever a command is not found.



This function can be viewed with declare -f command_not_found_handle and may look something like this (found on an Ubuntu system):



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 foundn" "$1" 1>&2;
return 127;
fi;
fi



As you can see, it uses some other tools called command-not-found.



To remove the predictions that this function makes, you can either remove this function altogether using



unset -f command_not_found_handle


(this is probably the best option) or, you can uninstall the executable that the function uses, assuming a system using apt:



sudo apt purge command-not-found


(the command-not-found command is part of the package of the same name on e.g. Ubuntu at least).



For more information about the command_not_found_handle function, see the bash manual.






share|improve this answer

























  • Perfect! Thanks.

    – command_not_found
    Feb 17 at 22:11











  • Hmm, I just did the unset command and ran the same command only with set instead of unset, but didn't retrieve the functionality. Do I see to restart my shell? (I'd rather not at the moment).

    – command_not_found
    Feb 17 at 22:25











  • @command_not_found You could try source /etc/bash.bashrc (or whatever the equivalent file is called on your system). On the Ubuntu machine I have access to, that file sets up the command_not_found_handle function.

    – Kusalananda
    Feb 17 at 22:32











  • It worked. Thanks.

    – command_not_found
    Feb 17 at 22:35











  • It does not have to be a Linux, to run apt (E.g. Ubuntu on WSL).

    – ctrl-alt-delor
    Feb 17 at 23:21















2














The bash shell calls a function called command_not_found_handle whenever a command is not found.



This function can be viewed with declare -f command_not_found_handle and may look something like this (found on an Ubuntu system):



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 foundn" "$1" 1>&2;
return 127;
fi;
fi



As you can see, it uses some other tools called command-not-found.



To remove the predictions that this function makes, you can either remove this function altogether using



unset -f command_not_found_handle


(this is probably the best option) or, you can uninstall the executable that the function uses, assuming a system using apt:



sudo apt purge command-not-found


(the command-not-found command is part of the package of the same name on e.g. Ubuntu at least).



For more information about the command_not_found_handle function, see the bash manual.






share|improve this answer

























  • Perfect! Thanks.

    – command_not_found
    Feb 17 at 22:11











  • Hmm, I just did the unset command and ran the same command only with set instead of unset, but didn't retrieve the functionality. Do I see to restart my shell? (I'd rather not at the moment).

    – command_not_found
    Feb 17 at 22:25











  • @command_not_found You could try source /etc/bash.bashrc (or whatever the equivalent file is called on your system). On the Ubuntu machine I have access to, that file sets up the command_not_found_handle function.

    – Kusalananda
    Feb 17 at 22:32











  • It worked. Thanks.

    – command_not_found
    Feb 17 at 22:35











  • It does not have to be a Linux, to run apt (E.g. Ubuntu on WSL).

    – ctrl-alt-delor
    Feb 17 at 23:21













2












2








2







The bash shell calls a function called command_not_found_handle whenever a command is not found.



This function can be viewed with declare -f command_not_found_handle and may look something like this (found on an Ubuntu system):



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 foundn" "$1" 1>&2;
return 127;
fi;
fi



As you can see, it uses some other tools called command-not-found.



To remove the predictions that this function makes, you can either remove this function altogether using



unset -f command_not_found_handle


(this is probably the best option) or, you can uninstall the executable that the function uses, assuming a system using apt:



sudo apt purge command-not-found


(the command-not-found command is part of the package of the same name on e.g. Ubuntu at least).



For more information about the command_not_found_handle function, see the bash manual.






share|improve this answer















The bash shell calls a function called command_not_found_handle whenever a command is not found.



This function can be viewed with declare -f command_not_found_handle and may look something like this (found on an Ubuntu system):



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 foundn" "$1" 1>&2;
return 127;
fi;
fi



As you can see, it uses some other tools called command-not-found.



To remove the predictions that this function makes, you can either remove this function altogether using



unset -f command_not_found_handle


(this is probably the best option) or, you can uninstall the executable that the function uses, assuming a system using apt:



sudo apt purge command-not-found


(the command-not-found command is part of the package of the same name on e.g. Ubuntu at least).



For more information about the command_not_found_handle function, see the bash manual.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 17 at 23:27

























answered Feb 17 at 22:08









KusalanandaKusalananda

135k17255422




135k17255422












  • Perfect! Thanks.

    – command_not_found
    Feb 17 at 22:11











  • Hmm, I just did the unset command and ran the same command only with set instead of unset, but didn't retrieve the functionality. Do I see to restart my shell? (I'd rather not at the moment).

    – command_not_found
    Feb 17 at 22:25











  • @command_not_found You could try source /etc/bash.bashrc (or whatever the equivalent file is called on your system). On the Ubuntu machine I have access to, that file sets up the command_not_found_handle function.

    – Kusalananda
    Feb 17 at 22:32











  • It worked. Thanks.

    – command_not_found
    Feb 17 at 22:35











  • It does not have to be a Linux, to run apt (E.g. Ubuntu on WSL).

    – ctrl-alt-delor
    Feb 17 at 23:21

















  • Perfect! Thanks.

    – command_not_found
    Feb 17 at 22:11











  • Hmm, I just did the unset command and ran the same command only with set instead of unset, but didn't retrieve the functionality. Do I see to restart my shell? (I'd rather not at the moment).

    – command_not_found
    Feb 17 at 22:25











  • @command_not_found You could try source /etc/bash.bashrc (or whatever the equivalent file is called on your system). On the Ubuntu machine I have access to, that file sets up the command_not_found_handle function.

    – Kusalananda
    Feb 17 at 22:32











  • It worked. Thanks.

    – command_not_found
    Feb 17 at 22:35











  • It does not have to be a Linux, to run apt (E.g. Ubuntu on WSL).

    – ctrl-alt-delor
    Feb 17 at 23:21
















Perfect! Thanks.

– command_not_found
Feb 17 at 22:11





Perfect! Thanks.

– command_not_found
Feb 17 at 22:11













Hmm, I just did the unset command and ran the same command only with set instead of unset, but didn't retrieve the functionality. Do I see to restart my shell? (I'd rather not at the moment).

– command_not_found
Feb 17 at 22:25





Hmm, I just did the unset command and ran the same command only with set instead of unset, but didn't retrieve the functionality. Do I see to restart my shell? (I'd rather not at the moment).

– command_not_found
Feb 17 at 22:25













@command_not_found You could try source /etc/bash.bashrc (or whatever the equivalent file is called on your system). On the Ubuntu machine I have access to, that file sets up the command_not_found_handle function.

– Kusalananda
Feb 17 at 22:32





@command_not_found You could try source /etc/bash.bashrc (or whatever the equivalent file is called on your system). On the Ubuntu machine I have access to, that file sets up the command_not_found_handle function.

– Kusalananda
Feb 17 at 22:32













It worked. Thanks.

– command_not_found
Feb 17 at 22:35





It worked. Thanks.

– command_not_found
Feb 17 at 22:35













It does not have to be a Linux, to run apt (E.g. Ubuntu on WSL).

– ctrl-alt-delor
Feb 17 at 23:21





It does not have to be a Linux, to run apt (E.g. Ubuntu on WSL).

– ctrl-alt-delor
Feb 17 at 23:21


Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay