Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

For some reason, with my setup, it can take Ubuntu several seconds to respond with "command not found" when I accidentally typo a command. Why does it take so long? Is there any way to shorten the period of time I have to wait?

I do have 13 directories in my PATH, but even so (most of them have just a few files in them), it shouldn't take several seconds to search 13 directories for a command right?

share|improve this question
add comment

2 Answers

up vote 28 down vote accepted

The shell does more than just looking in $PATH. If a command is not found, the bash function command_not_found_handle is executed which in its turn call the python script /usr/lib/command-not-found. This searches in the packages list for programs that should be installed for the command to work. In the case of a typo which you know how to solve, just press Ctrl + C to abort the search process.

Example of a useful message for a typo:

$ aptget update
No command 'aptget' found, did you mean:
 Command 'apt-get' from package 'apt' (main)
aptget: command not found

Example of a useful message for a missing package:

$ deja-dup
The program 'deja-dup' is currently not installed.  You can install it by typing:
sudo apt-get install deja-dup

See also the rationale behind this, https://wiki.ubuntu.com/CommandNotFoundMagic

share|improve this answer
2  
Linus posted something on this: plus.google.com/u/0/102150693225130002912/posts/iz7zR9B1Prv –  bcbc Nov 1 '11 at 19:24
    
And I consider this to be a truly amazing feature! If you use a command you expect to be present but isn't there, you are directly told what to type to install it. –  Thorbjørn Ravn Andersen Aug 30 '13 at 12:53
add comment

It's because of a package named "command-not-found". You can uninstall it to shorten the response time.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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