Why a long delay after command not found?












16














Often when I mistype a command such as ls (e.g. I hit ENTER before I type 's') there is a long (~2s) delay after the terminal displays:



bash: l: command not found...


I can understand the reasons for a similar delay after an incorrect password is entered, per Why is there a big delay after entering a wrong password?. But why delay after an unrecognized command? Does FAIL_DELAY in /etc/login.defs affect this also?










share|improve this question




















  • 7




    Maybe Fedora is now also using that horrible Ubuntu misfeature that tells you "This program is not installed, to install it, type ..."? The delay is then caused by searching the database of all installable packages. Try calling psql (part of PostgreSQL), which is probably not installed by default, but is hopefully in the repositories.
    – Ulrich Schwarz
    Nov 29 '11 at 18:51












  • What does echo "$PROMPT_COMMAND" output?
    – rozcietrzewiacz
    Nov 29 '11 at 19:28










  • echo "$PROMPT_COMMAND": printf "33]0;%s@%s:%s07" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
    – paislee
    Nov 29 '11 at 19:48










  • what echo $PATH prints ? your system is check there each time you hit the return key.
    – Hanan N.
    Nov 29 '11 at 21:22
















16














Often when I mistype a command such as ls (e.g. I hit ENTER before I type 's') there is a long (~2s) delay after the terminal displays:



bash: l: command not found...


I can understand the reasons for a similar delay after an incorrect password is entered, per Why is there a big delay after entering a wrong password?. But why delay after an unrecognized command? Does FAIL_DELAY in /etc/login.defs affect this also?










share|improve this question




















  • 7




    Maybe Fedora is now also using that horrible Ubuntu misfeature that tells you "This program is not installed, to install it, type ..."? The delay is then caused by searching the database of all installable packages. Try calling psql (part of PostgreSQL), which is probably not installed by default, but is hopefully in the repositories.
    – Ulrich Schwarz
    Nov 29 '11 at 18:51












  • What does echo "$PROMPT_COMMAND" output?
    – rozcietrzewiacz
    Nov 29 '11 at 19:28










  • echo "$PROMPT_COMMAND": printf "33]0;%s@%s:%s07" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
    – paislee
    Nov 29 '11 at 19:48










  • what echo $PATH prints ? your system is check there each time you hit the return key.
    – Hanan N.
    Nov 29 '11 at 21:22














16












16








16







Often when I mistype a command such as ls (e.g. I hit ENTER before I type 's') there is a long (~2s) delay after the terminal displays:



bash: l: command not found...


I can understand the reasons for a similar delay after an incorrect password is entered, per Why is there a big delay after entering a wrong password?. But why delay after an unrecognized command? Does FAIL_DELAY in /etc/login.defs affect this also?










share|improve this question















Often when I mistype a command such as ls (e.g. I hit ENTER before I type 's') there is a long (~2s) delay after the terminal displays:



bash: l: command not found...


I can understand the reasons for a similar delay after an incorrect password is entered, per Why is there a big delay after entering a wrong password?. But why delay after an unrecognized command? Does FAIL_DELAY in /etc/login.defs affect this also?







bash command-line fedora command-not-found






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:36









Community

1




1










asked Nov 29 '11 at 18:24









paisleepaislee

250139




250139








  • 7




    Maybe Fedora is now also using that horrible Ubuntu misfeature that tells you "This program is not installed, to install it, type ..."? The delay is then caused by searching the database of all installable packages. Try calling psql (part of PostgreSQL), which is probably not installed by default, but is hopefully in the repositories.
    – Ulrich Schwarz
    Nov 29 '11 at 18:51












  • What does echo "$PROMPT_COMMAND" output?
    – rozcietrzewiacz
    Nov 29 '11 at 19:28










  • echo "$PROMPT_COMMAND": printf "33]0;%s@%s:%s07" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
    – paislee
    Nov 29 '11 at 19:48










  • what echo $PATH prints ? your system is check there each time you hit the return key.
    – Hanan N.
    Nov 29 '11 at 21:22














  • 7




    Maybe Fedora is now also using that horrible Ubuntu misfeature that tells you "This program is not installed, to install it, type ..."? The delay is then caused by searching the database of all installable packages. Try calling psql (part of PostgreSQL), which is probably not installed by default, but is hopefully in the repositories.
    – Ulrich Schwarz
    Nov 29 '11 at 18:51












  • What does echo "$PROMPT_COMMAND" output?
    – rozcietrzewiacz
    Nov 29 '11 at 19:28










  • echo "$PROMPT_COMMAND": printf "33]0;%s@%s:%s07" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
    – paislee
    Nov 29 '11 at 19:48










  • what echo $PATH prints ? your system is check there each time you hit the return key.
    – Hanan N.
    Nov 29 '11 at 21:22








7




7




Maybe Fedora is now also using that horrible Ubuntu misfeature that tells you "This program is not installed, to install it, type ..."? The delay is then caused by searching the database of all installable packages. Try calling psql (part of PostgreSQL), which is probably not installed by default, but is hopefully in the repositories.
– Ulrich Schwarz
Nov 29 '11 at 18:51






Maybe Fedora is now also using that horrible Ubuntu misfeature that tells you "This program is not installed, to install it, type ..."? The delay is then caused by searching the database of all installable packages. Try calling psql (part of PostgreSQL), which is probably not installed by default, but is hopefully in the repositories.
– Ulrich Schwarz
Nov 29 '11 at 18:51














What does echo "$PROMPT_COMMAND" output?
– rozcietrzewiacz
Nov 29 '11 at 19:28




What does echo "$PROMPT_COMMAND" output?
– rozcietrzewiacz
Nov 29 '11 at 19:28












echo "$PROMPT_COMMAND": printf "33]0;%s@%s:%s07" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
– paislee
Nov 29 '11 at 19:48




echo "$PROMPT_COMMAND": printf "33]0;%s@%s:%s07" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
– paislee
Nov 29 '11 at 19:48












what echo $PATH prints ? your system is check there each time you hit the return key.
– Hanan N.
Nov 29 '11 at 21:22




what echo $PATH prints ? your system is check there each time you hit the return key.
– Hanan N.
Nov 29 '11 at 21:22










4 Answers
4






active

oldest

votes


















20














after some research i have found this:




  • try to uninstall the command-not-found package with $>yum remove command-not-found then install it again with >$yum install command-not-found (just in case you have that package installed on your system).


if that doesn't help try:





  • add this to your ~/.bashrc file:



    unset command_not_found_handle








share|improve this answer



















  • 2




    Second suggestion removed the delay. I do not have the package command-not-found installed. Thanks!
    – paislee
    Nov 29 '11 at 21:53





















12














I found that the best solution, at least on Fedora, is to modify the configuration file
/etc/PackageKit/CommandNotFound.conf



as the biggest delay comes from the search for packages to install, if you modify
SoftwareSourceSearch=true in SoftwareSourceSearch=false



the delay is almost 0 and you still get warned about misspellings, which can be useful.






share|improve this answer





























    2














    Fedora uses something similar.



    If you want to just remove this feature use:



    yum remove PackageKit-command-not-found





    share|improve this answer





















    • Follow up: I forgot to mention if you remove this package you will get an error message: bash: /usr/libexec/pk-command-not-found: No such file or directory To fix this create the file after removeing the package, /usr/libexec/pk-command-not-found with the following: #!/bin/sh echo "Command not found: $1" This will print: Command not found: fail-command
      – user16852
      Mar 21 '12 at 5:31





















    0














    In my case it's because of some known proxy bug in /usr/libexec/pk-command-not-found



    Failed to search for file: cannot update repo 'updates':
    Cannot prepare internal mirrorlist:
    Curl error (28): Timeout was reached for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f28&arch=x86_64
    [Connection timed out after 30002 milliseconds]


    My proxy configuration is correct because downloading the exact same URL with a bare curl command succeeds instantly.



    I checked the pk-command-not-found process does have the proxy configuration:



    tr  '' 'n' < /proc/$(pgrep -f pk-command-not-found)/environ | grep -i proxy


    However it does not use it for some unknown reason.



    https://bugzilla.redhat.com/show_bug.cgi?id=1553368





    share





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f25681%2fwhy-a-long-delay-after-command-not-found%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      20














      after some research i have found this:




      • try to uninstall the command-not-found package with $>yum remove command-not-found then install it again with >$yum install command-not-found (just in case you have that package installed on your system).


      if that doesn't help try:





      • add this to your ~/.bashrc file:



        unset command_not_found_handle








      share|improve this answer



















      • 2




        Second suggestion removed the delay. I do not have the package command-not-found installed. Thanks!
        – paislee
        Nov 29 '11 at 21:53


















      20














      after some research i have found this:




      • try to uninstall the command-not-found package with $>yum remove command-not-found then install it again with >$yum install command-not-found (just in case you have that package installed on your system).


      if that doesn't help try:





      • add this to your ~/.bashrc file:



        unset command_not_found_handle








      share|improve this answer



















      • 2




        Second suggestion removed the delay. I do not have the package command-not-found installed. Thanks!
        – paislee
        Nov 29 '11 at 21:53
















      20












      20








      20






      after some research i have found this:




      • try to uninstall the command-not-found package with $>yum remove command-not-found then install it again with >$yum install command-not-found (just in case you have that package installed on your system).


      if that doesn't help try:





      • add this to your ~/.bashrc file:



        unset command_not_found_handle








      share|improve this answer














      after some research i have found this:




      • try to uninstall the command-not-found package with $>yum remove command-not-found then install it again with >$yum install command-not-found (just in case you have that package installed on your system).


      if that doesn't help try:





      • add this to your ~/.bashrc file:



        unset command_not_found_handle









      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jul 2 '14 at 7:57

























      answered Nov 29 '11 at 21:35









      Hanan N.Hanan N.

      3,62132028




      3,62132028








      • 2




        Second suggestion removed the delay. I do not have the package command-not-found installed. Thanks!
        – paislee
        Nov 29 '11 at 21:53
















      • 2




        Second suggestion removed the delay. I do not have the package command-not-found installed. Thanks!
        – paislee
        Nov 29 '11 at 21:53










      2




      2




      Second suggestion removed the delay. I do not have the package command-not-found installed. Thanks!
      – paislee
      Nov 29 '11 at 21:53






      Second suggestion removed the delay. I do not have the package command-not-found installed. Thanks!
      – paislee
      Nov 29 '11 at 21:53















      12














      I found that the best solution, at least on Fedora, is to modify the configuration file
      /etc/PackageKit/CommandNotFound.conf



      as the biggest delay comes from the search for packages to install, if you modify
      SoftwareSourceSearch=true in SoftwareSourceSearch=false



      the delay is almost 0 and you still get warned about misspellings, which can be useful.






      share|improve this answer


























        12














        I found that the best solution, at least on Fedora, is to modify the configuration file
        /etc/PackageKit/CommandNotFound.conf



        as the biggest delay comes from the search for packages to install, if you modify
        SoftwareSourceSearch=true in SoftwareSourceSearch=false



        the delay is almost 0 and you still get warned about misspellings, which can be useful.






        share|improve this answer
























          12












          12








          12






          I found that the best solution, at least on Fedora, is to modify the configuration file
          /etc/PackageKit/CommandNotFound.conf



          as the biggest delay comes from the search for packages to install, if you modify
          SoftwareSourceSearch=true in SoftwareSourceSearch=false



          the delay is almost 0 and you still get warned about misspellings, which can be useful.






          share|improve this answer












          I found that the best solution, at least on Fedora, is to modify the configuration file
          /etc/PackageKit/CommandNotFound.conf



          as the biggest delay comes from the search for packages to install, if you modify
          SoftwareSourceSearch=true in SoftwareSourceSearch=false



          the delay is almost 0 and you still get warned about misspellings, which can be useful.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 7 '12 at 12:41









          GiPGiP

          12112




          12112























              2














              Fedora uses something similar.



              If you want to just remove this feature use:



              yum remove PackageKit-command-not-found





              share|improve this answer





















              • Follow up: I forgot to mention if you remove this package you will get an error message: bash: /usr/libexec/pk-command-not-found: No such file or directory To fix this create the file after removeing the package, /usr/libexec/pk-command-not-found with the following: #!/bin/sh echo "Command not found: $1" This will print: Command not found: fail-command
                – user16852
                Mar 21 '12 at 5:31


















              2














              Fedora uses something similar.



              If you want to just remove this feature use:



              yum remove PackageKit-command-not-found





              share|improve this answer





















              • Follow up: I forgot to mention if you remove this package you will get an error message: bash: /usr/libexec/pk-command-not-found: No such file or directory To fix this create the file after removeing the package, /usr/libexec/pk-command-not-found with the following: #!/bin/sh echo "Command not found: $1" This will print: Command not found: fail-command
                – user16852
                Mar 21 '12 at 5:31
















              2












              2








              2






              Fedora uses something similar.



              If you want to just remove this feature use:



              yum remove PackageKit-command-not-found





              share|improve this answer












              Fedora uses something similar.



              If you want to just remove this feature use:



              yum remove PackageKit-command-not-found






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 21 '12 at 5:26







              user16852



















              • Follow up: I forgot to mention if you remove this package you will get an error message: bash: /usr/libexec/pk-command-not-found: No such file or directory To fix this create the file after removeing the package, /usr/libexec/pk-command-not-found with the following: #!/bin/sh echo "Command not found: $1" This will print: Command not found: fail-command
                – user16852
                Mar 21 '12 at 5:31




















              • Follow up: I forgot to mention if you remove this package you will get an error message: bash: /usr/libexec/pk-command-not-found: No such file or directory To fix this create the file after removeing the package, /usr/libexec/pk-command-not-found with the following: #!/bin/sh echo "Command not found: $1" This will print: Command not found: fail-command
                – user16852
                Mar 21 '12 at 5:31


















              Follow up: I forgot to mention if you remove this package you will get an error message: bash: /usr/libexec/pk-command-not-found: No such file or directory To fix this create the file after removeing the package, /usr/libexec/pk-command-not-found with the following: #!/bin/sh echo "Command not found: $1" This will print: Command not found: fail-command
              – user16852
              Mar 21 '12 at 5:31






              Follow up: I forgot to mention if you remove this package you will get an error message: bash: /usr/libexec/pk-command-not-found: No such file or directory To fix this create the file after removeing the package, /usr/libexec/pk-command-not-found with the following: #!/bin/sh echo "Command not found: $1" This will print: Command not found: fail-command
              – user16852
              Mar 21 '12 at 5:31













              0














              In my case it's because of some known proxy bug in /usr/libexec/pk-command-not-found



              Failed to search for file: cannot update repo 'updates':
              Cannot prepare internal mirrorlist:
              Curl error (28): Timeout was reached for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f28&arch=x86_64
              [Connection timed out after 30002 milliseconds]


              My proxy configuration is correct because downloading the exact same URL with a bare curl command succeeds instantly.



              I checked the pk-command-not-found process does have the proxy configuration:



              tr  '' 'n' < /proc/$(pgrep -f pk-command-not-found)/environ | grep -i proxy


              However it does not use it for some unknown reason.



              https://bugzilla.redhat.com/show_bug.cgi?id=1553368





              share


























                0














                In my case it's because of some known proxy bug in /usr/libexec/pk-command-not-found



                Failed to search for file: cannot update repo 'updates':
                Cannot prepare internal mirrorlist:
                Curl error (28): Timeout was reached for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f28&arch=x86_64
                [Connection timed out after 30002 milliseconds]


                My proxy configuration is correct because downloading the exact same URL with a bare curl command succeeds instantly.



                I checked the pk-command-not-found process does have the proxy configuration:



                tr  '' 'n' < /proc/$(pgrep -f pk-command-not-found)/environ | grep -i proxy


                However it does not use it for some unknown reason.



                https://bugzilla.redhat.com/show_bug.cgi?id=1553368





                share
























                  0












                  0








                  0






                  In my case it's because of some known proxy bug in /usr/libexec/pk-command-not-found



                  Failed to search for file: cannot update repo 'updates':
                  Cannot prepare internal mirrorlist:
                  Curl error (28): Timeout was reached for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f28&arch=x86_64
                  [Connection timed out after 30002 milliseconds]


                  My proxy configuration is correct because downloading the exact same URL with a bare curl command succeeds instantly.



                  I checked the pk-command-not-found process does have the proxy configuration:



                  tr  '' 'n' < /proc/$(pgrep -f pk-command-not-found)/environ | grep -i proxy


                  However it does not use it for some unknown reason.



                  https://bugzilla.redhat.com/show_bug.cgi?id=1553368





                  share












                  In my case it's because of some known proxy bug in /usr/libexec/pk-command-not-found



                  Failed to search for file: cannot update repo 'updates':
                  Cannot prepare internal mirrorlist:
                  Curl error (28): Timeout was reached for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f28&arch=x86_64
                  [Connection timed out after 30002 milliseconds]


                  My proxy configuration is correct because downloading the exact same URL with a bare curl command succeeds instantly.



                  I checked the pk-command-not-found process does have the proxy configuration:



                  tr  '' 'n' < /proc/$(pgrep -f pk-command-not-found)/environ | grep -i proxy


                  However it does not use it for some unknown reason.



                  https://bugzilla.redhat.com/show_bug.cgi?id=1553368






                  share











                  share


                  share










                  answered 4 mins ago









                  MarcHMarcH

                  1011




                  1011






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f25681%2fwhy-a-long-delay-after-command-not-found%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      濃尾地震

                      How to rewrite equation of hyperbola in standard form

                      No ethernet ip address in my vocore2