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.

When you write the command name wrong, bash often does this:

septi@norbert:~$ good
No command 'good' found, did you mean:
 Command 'gold' from package 'binutils' (main)
 Command 'gmod' from package 'gmod' (universe)
 Command 'goo' from package 'goo' (universe)
 Command 'god' from package 'god' (universe)
 Command 'geod' from package 'proj-bin' (universe)
 Command 'gord' from package 'scotch' (universe)
good: command not found

Or sometimes it does this:

septi@norbert:~$ nftp
No command 'nftp' found, but there are 23 similar ones
nftp: command not found

Is there any way to ask bash to show these 23 similar commands for me? And, is there a way to show similar commands, including those that aren't yet installed, instead of running the application, ftp for example?

share|improve this question
add comment

2 Answers 2

It's quite likely that the 23 "similar" commands would not be much more use to you than 'goo', 'god', and 'gord'. The little trick most bash'ers use to find things is to use the man pages since the search is content based rather than just by name. For example, try

man -k ftp

If you find a likely or insteresting command look at the man page itself by dropping the -k switch:

man sftp

man has it's own manual page:

man man

Now you know why, whenever you install a new program or application it very often installs a man page for you as well.

Oh yes, to search in or for man pages you haven't installed yet you might like one of the many online man sites such as this one.

share|improve this answer
add comment

bash uses the command /usr/lib/command-not-found for looking similar commands.This in turn uses the CommandNotFound module of Python. The output you see on the terminal(stderr in this case), is also generated from this module. The location of this module is /usr/lib/python2.7/dist-packages/CommandNotFound/CommandNotFound.py. There is a default limit set on number of similar commands in function print_spelling_suggestion(self, word, min_len=3, max_len=15)[Line number:124]. You can modify the max_len value to say 30 (Use sudo to edit this file).

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.