如果我得到这个:
No command 'pdf' found, but there are 16 similar ones
pdf: command not found
如何查看这16条类似的命令?
答案1
如果您知道命令名称的一部分,您可以尝试apropos
,例如,在您的例子中
apropos pdf
答案2
你可以使用ctrl+r并开始输入命令。如果你之前使用过,它会显示出来。这是一个节省大量时间的好技巧。
答案3
正如之前答案所暗示的那样有什么方法可以列出类似的命令吗?获得它们的方法似乎是直接spelling_suggestions
从CommandNotFound
python 模块执行方法,然后print_spelling_suggestions
用其参数的适当大值max_alt
代替默认值进行调用15
:
$ python3 -c '
import sys
from CommandNotFound import CommandNotFound
cmd = sys.argv[1]
cnf = CommandNotFound.CommandNotFound()
cnf.print_spelling_suggestions(cmd,cnf.spelling_suggestions(cmd),[],100)
' pdf
Command 'pdf' not found, did you mean:
command 'sdf' from deb sdf
command 'puf' from deb puf
command 'pydf' from deb pydf
command 'pdv' from deb alliance
command 'psf' from deb tcm
command 'pdl' from deb pdl
command 'xpdf' from deb xpdf
command 'wdf' from deb wit
command 'kdf' from deb kdf
command 'df' from deb coreutils
command 'pdd' from deb pdd
command 'pda' from deb speech-tools
command 'qpdf' from deb qpdf
command 'p0f' from deb p0f
command 'paf' from deb libpod-abstract-perl
command 'pd' from deb puredata-core
command 'pdb' from deb python
Try: sudo apt install <deb name>
答案4
如果你只想要在你的终端,
我推荐这个应用程序: https://github.com/nvbn/thefuck
您可以通过以下方式安装pip3
:
sudo apt update
sudo apt install python3-dev python3-pip python3-setuptools
sudo pip3 install thefuck
并根据您的喜好在类似.bashrc
shell 的文件中对其进行配置:
eval $(thefuck --alias)
# You can use whatever you want as an alias, like for Mondays:
eval $(thefuck --alias FUCK)
history | grep pdf
此外,如果您之前执行过正确的命令,类似的组合命令也可以起作用。