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?

  • 9
    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 "\033]0;%s@%s:%s\007" "${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

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

  • 2
    Second suggestion removed the delay. I do not have the package command-not-found installed. Thanks! – paislee Nov 29 '11 at 21:53
  • 1
    I question the judgement of whomever thought it was a good idea to enable this by default – fostandy Nov 9 '19 at 1:45

I found that the best solution, at least on Fedora, is to modify the configuration file

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.


Fedora uses something similar.

If you want to just remove this feature use:

yum remove PackageKit-command-not-found
  • 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

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  '\0' '\n' < /proc/$(pgrep -f pk-command-not-found)/environ | grep -i proxy

However it does not use it for some unknown reason.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.