为什么“whatis”命令不起作用?

为什么“whatis”命令不起作用?

当我运行该whatis命令时,无论我传递什么命令,它都只是输出“没有任何适当的内容”。

$ whatis grep
grep: nothing appropriate.

的输出whatis -d grep

From the config file /etc/manpath.config:
  Mandatory mandir `/usr/man'.
  Mandatory mandir `/usr/share/man'.
  Mandatory mandir `/usr/local/share/man'.
  Path `/bin' mapped to mandir `/usr/share/man'.
  Path `/usr/bin' mapped to mandir `/usr/share/man'.
  Path `/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/X11R6/bin' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/bin/X11' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/games' mapped to mandir `/usr/share/man'.
  Path `/opt/bin' mapped to mandir `/opt/man'.
  Path `/opt/sbin' mapped to mandir `/opt/man'.
  Global mandir `/usr/man', catdir `/var/cache/man/fsstnd'.
  Global mandir `/usr/share/man', catdir `/var/cache/man'.
  Global mandir `/usr/local/man', catdir `/var/cache/man/oldlocal'.
  Global mandir `/usr/local/share/man', catdir `/var/cache/man/local'.
  Global mandir `/usr/X11R6/man', catdir `/var/cache/man/X11R6'.
  Global mandir `/opt/man', catdir `/var/cache/man/opt'.
  Global mandir `/snap/man', catdir `/var/cache/man/snap'.
  Added sections: `1', `n', `l', `8', `3', `2', `3posix', `3pm', `3perl', `3am', `5', `4', `9', `6', `7'.
path directory /usr/local/sbin is in the config file
  adding /usr/local/man to manpath
  adding /usr/local/share/man to manpath
path directory /usr/local/bin is in the config file
path directory /usr/sbin is in the config file
  adding /usr/share/man to manpath
path directory /usr/bin is in the config file
path directory /sbin is in the config file
path directory /bin is in the config file
path directory /usr/games is in the config file
path directory /usr/local/games is not in the config file
adding mandatory man directories
warning: /usr/man: No such file or directory
add_nls_manpaths(): processing /usr/local/man:/usr/local/share/man:/usr/share/man
checking for locale en_US.UTF-8
adding /usr/local/man to manpathlist
adding /usr/share/man to manpathlist
final search path = /usr/local/man:/usr/share/man
path=/usr/local/man
warning: can't read the fallback whatis text database /usr/local/man/whatis
path=/usr/share/man
warning: can't read the fallback whatis text database /usr/share/man/whatis
grep: nothing appropriate.

我该如何解决这个问题?

答案1

这些消息告诉您问题所在:

final search path = /usr/local/man:/usr/share/man
path=/usr/local/man
warning: can't read the fallback whatis text database /usr/local/man/whatis
path=/usr/share/man
warning: can't read the fallback whatis text database /usr/share/man/whatis
grep: nothing appropriate.

并且(根据所使用的系统,有不同的联机帮助页可供阅读),但是例如

指数 数据库在搜索过程中使用,并由 mandb 程序更新。根据您的安装,这可能由定期 cron 作业运行,或者可能需要在安装新手册页后手动运行。要从相对索引数据库生成旧式文本 Whatis 数据库,请发出以下命令:

whatis -M manpath -w '*' | sort > manpath/whatis

在哪里manpath是一个手册页层次结构,例如/usr/man.

和中的“ whatis”文件可能丢失或损坏。重新创建这些会改善问题。/usr/local/man/usr/share/man

答案2

尝试运行mandb,它应该会自动创建这些东西。如果您手动安装了手册页,并且未安装 mandb,则首先安装 mandb。

相关内容