6

In ubuntu, if I type a command for a application that is not installed, but that it knows about from a db, it gives me a message like this:

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

Is there a way to get a similar message in Arch Linux?

2 Answers 2

1

Was looking for exactly the same, found brilliant solution here: https://bbs.archlinux.org/viewtopic.php?pid=874678#p874678

When installing pkgtools, more info pops out:

(2/2) installing pkgtools
- Make sure to run pkgfile --update before use
- pkgfile includes a "command not found" hook for both zsh and bash.

  This will automatically run pkgfile whenever you run
  a command which the shell cannot find. If you want
  this functionality, set CMD_SEARCH_ENABLED to 1 in
  /etc/pkgtools/pkgfile.conf (or per-user by copying
  that file to ${XDG_CONFIG_HOME}/pkgtools/pkgfile.conf), then
  in your current shell run:
  source /etc/profile

- An entry has been placed in /etc/cron.daily to run pkgfile --update
  If you do not want this functionality, set UPDATE_CRON=0 in /etc/pkgtools/pkgfile.conf
2

So this seems to be part of python, in ubuntu its in:
/usr/lib64/python2.7/dist-packages/CommandNotFound/CommandNotFound.py
in the following function:

def advise(self, command, ignore_installed=False):
    " give advice where to find the given command to stderr "

I found the launchpad project that implements this: https://launchpad.net/command-not-found

Hope this helps

1
  • The code relies on a database. I assume that this is generated by examining all the binary packages for binaries installed to the default path dirs. Does such a database already exist for arch? Generating such a database would require downloading all the packages, a resource I don't have. Sep 20, 2011 at 7:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .