I love this new feature in Ubuntu Feisty..
Edit: According to these pages this is also in Ubuntu Edgy (6.10), the current stable release.
If you type a command on Linux that doesn’t exist, normally you get this:-
alan@bishop:~$ mplayer -bash: mplayer: command not found
With the package command-not-found installed (which is by default installed as of Ubuntu 7.04 [Feisty] [due out in April]) you get something like this:-
alan@tigger:~$ mplayer The program 'mplayer' can be found in the following packages: * mplayer-nogui * mplayer Try: sudo apt-get install <selected package> Make sure you have the 'multiverse' component enabled -bash: mplayer: command not found
How cool is that!?
Works for loads of things. There is a database in the dependent package “command-not-found-data”.
alan@tigger:~$ cowsay The program 'cowsay' is currently not installed. You can install it by typing: sudo apt-get install cowsay Make sure you have the 'universe' component enabled -bash: cowsay: command not found alan@tigger:~$ figlet The program 'figlet' can be found in the following packages: * figlet * toilet Try: sudo apt-get install <selected package> Make sure you have the 'universe' component enabled -bash: figlet: command not found
Of course if you spell the command incorrectly it all goes to pot a bit:-
alan@tigger:~$ moonbuggy -bash: moonbuggy: command not found alan@tigger:~$ moon-buggy The program 'moon-buggy' can be found in the following packages: * moon-buggy * moon-buggy-esd Try: sudo apt-get install <selected package> Make sure you have the 'universe' component enabled -bash: moon-buggy: command not found
However if you are following a tutorial or mailing list posting that suggests you run a command that doesn’t exist on your system at least it gives you a good way to solve the issue without having to search for the package containing the command.
As with all things it’s under development and may have bugs, which can be reported/viewed in launchpad:-
https://launchpad.net/ubuntu/+source/command-not-found/+bugs













13 Comments
Thanks a lot for the tip !
For me it worked immediatly. I just had to relogin on that shell
I’ve added the package (sudo apt-get install command-not-found), but it doesn’t perform as you’ve demonstrated. Do I need to do anything else?
The README is in /usr/share/doc/command-not-found/README and says:-
(actually it says add “. /etc/bash_command_nof_found” but that has already been reported as a bug:- https://bugs.launchpad.net/ubuntu/+source/command-not-found/+bug/94088)
You will need to start a new terminal or logout and login again for that change to take effect I suspect.
Whoa. If it is too lame to understand between misspellings and not-yet-installed packages, it is a reckless thing to add to a user-friendly OS.
I’m still sort of a newbie, so I’m still not used to reading the docs as soon as installing something new.
Works like a charm, anyway.
Thanks!
As the upstream author I can’t say how happy I am that this little tool is actually usefull to someone. Feel free to file bugs and send patches if something sensible is missing.
I did steal an idea of yours – I’ll add checks for misspelled packages. Should ship with fesity + 1
Great tool, thanks for dropping by.
I have a Virtual Machine which has a basic install of Feisty with no extras. I have installed it and then added the necessary updates. I noted a week or so ago the command-not-found packages arrive, but didn’t realise what it was until a few days later when I typed something and the magic happened.
Having a bit of a poke around, it looks like the ubuntu-standard package recommends command-not-found.
Which meta package pulls it in?
this is excellent. As we all know, Ubuntu doesn’t ship build-essential or gcc by default. I hope trying someone following instructions, when they type “make”, build-essential is installed instead of just gcc….how about the equivalent dependancies that a .configure file complains of too? SOmetimes they’re just named differently in Debian repos.
This is pretty sweet I must admit. Nice little features like this are what continue to secure the success of Ubuntu and Linux in general. Nice stuff!
Did I get that right? It uses the static database from the command-not-found-data package?
Nice for a stable distribution, it should have used apt-file’s database to be usable for all distributions.
But with apt-file you need to update it don’t you?
I installed apt-file recently and had to “apt-file update” before “apt-file search /usr/foo/bar” would find anything.
It’s not installed by default either, although I guess it could be a dependancy.