Linux – Get recommened pacman install line when command not found

arch linux

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?

Best Answer

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
Related Question