我知道我可以man commandname
找到特定命令的文档,但很多时候我只是简单地在 Google 上搜索“如何按大小排序列出所有已安装的软件包”或“如何递归地按文件夹中的内容查找文件”,然后通常我会询问 ubuntu / superuser / stackoverflow 并且 99/100 被接受/投票最多的答案包含所需的命令,我复制、粘贴并获利。
我的问题是,是否有任何命令行实用程序可以执行如下操作:
$ howto "get available disk space"
并返回
$ according to Stackoverflow, the command is "df -h" with 90% accuracy
$ 1) [run]
$ 2) run as sudo
$ 3) give next suggestion
$ 4) this is not right! (you'll be able to provide your suggestion next)
$ 5) exit
这有点像http://gkoberger.github.io/stacksort/根据此 XKCD 的替代文本:http://xkcd.com/1185/
找不到类似的东西,它存在吗?
答案1
虽然它的功能不如 google 全面,但你可以使用 查找本地命令apropos
。例如:
$ apropos "disk space"
df (1) - report file system disk space usage
apropos
搜索手册页。其参数可以包含通配符 ( apropos -w
) 或正则表达式 ( apropos -r
)。
man apropos
解释:
Each manual page has a short description available within it. apropos searches the descriptions for instances of keyword. keyword is usually a regular expression, as if (-r) was used, or may contain wildcards (-w), or match the exact keyword (-e). Using these options, it may be necessary to quote the keyword or escape (\) the special characters to stop the shell from interpreting them. The standard matching rules allow matches to be made against the page name and word boundaries in the descrip‐ tion.
答案2
显然有!它是命令行的 Siri:https://github.com/pickhardt/betty