如何在终端中找到类似的命令?

如何在终端中找到类似的命令?

我知道“clear”命令,但我不小心输入了“cls”。然后我收到一条消息,上面写着:

No command 'cls' found, but there are 18 similar ones

那么告诉我有 18 个类似的命令有什么意义呢?有没有办法查看终端提到的命令?

答案1

你可以尝试类似

man -k '^cl'

这将列出所有以“cl”开头的手册页。与您的问题不直接匹配,但为您提供了其他命令,例如 clear、clearenv、clock 等。

答案2

当输入未知命令时,Bash 会给出建议。

$ apr
No command 'apr' found, did you mean:
 Command 'arp' from package 'net-tools' (main)
 Command 'apm' from package 'apmd' (main)
 Command 'apf' from package 'apf-firewall' (universe)
 Command 'apg' from package 'apg' (main)
 Command 'pr' from package 'coreutils' (main)
 Command 'gpr' from package 'gpr' (universe)
 Command 'ar' from package 'binutils' (main)
 Command 'ar' from package 'binutils-multiarch' (universe)
 Command 'par' from package 'par' (universe)
 Command 'lpr' from package 'lpr' (universe)
 Command 'lpr' from package 'lprng' (universe)
 Command 'lpr' from package 'gnuspool' (universe)
 Command 'lpr' from package 'cups-bsd' (main)
apr: command not found

如果存在两种可能,那么 bash 只会告诉您有多少种。实际上,这没什么用。

相关内容