Kmdr-终端中的Display CLI命令说明

时间:2020-03-21 11:45:58  来源:igfitidea点击:

ExplainShell是一个基于Web的工具,用于学习Linux命令的每个部分的功能。

它将复杂而冗长的Linux命令分为多个部分,并给出了每个部分的说明。
使用此工具,Linux新手无需参考手册页即可了解各种命令行参数和选项。
但是,它只会学习Linux命令。
但是,如果我们想学习其他CLI命令,例如Python,该怎么办?
我们不会在ExplainShell中找到有关Python命令的说明。
不用担心!今天,我偶然发现了一个名为Kmdr的类似工具,该工具为数百个程序提供了CLI命令说明。
它可以轻松学习CLI命令,而无需离开终端,也无需浏览冗长的手册页。
Kmdr不仅提供Linux命令,还提供了许多CLI命令的解释,包括ansible,conda,docker,git,go,kubectl,mongo,mysql,npm,ruby gems,vagrant和数百种其他程序,例如内置在bash中的程序。

Kmdr可以理解复杂的长指令和子指令。
它还将理解包括管道,重定向,列表构造以及其他bash-buildins和运算符在内的命令。
Kmdr为我们提供了以下列出的各种程序,工具和实用程序的解释。

  • Bash Shell内置文件(例如echo,export,cd)。
  • 容器(例如Docker,kubectl)。
  • 版本控制(例如Git)。
  • 数据库服务器和客户端(例如mysql,mongod)。
  • 部署/云(例如现在为云)。
  • 文件和归档工具(例如zip,tar)。
  • 媒体(例如ffmpeg,youtube-dl)。
  • 网络/通讯(例如netstat,nmap,curl)。
  • 包管理器(例如dpkg,pip)。
  • 编程语言/运行时环境/编译器(例如go,python,node,gcc)。
  • Sysadmin /监控(例如crontab,顶部)。
  • 文字处理(例如awk,sed)。
  • 文字编辑器(例如nano,vim)。
  • 其他(例如openssl,bash,bash64)。

我们可以在此处查看受支持程序的完整列表。

开发人员每天都在添加更多程序。
请留意列表,并不时检查列表。

Kmdr是用Node.js编写的免费开放源代码实用程序。

安装Kmdr CLI

Kmdr需要Nodejs版本8.x或者更高版本。
如果我们尚未在Linux系统上安装Nodejs,请参考以下链接。

  • 如何在Linux上安装NodeJS

安装Nodejs之后,我们可以使用Npm软件包管理器安装Kmdr CLI,如下所示。

$npm install Hyman@theitroad --global

也可以从Web浏览器直接使用Kmdr。
无需安装或者注册!只需打开Web浏览器并导航到以下链接并提供命令即可。

  • http://demo.kmdr.sh/

使用Kmdr的终端中的显示CLI命令说明

获得CLI命令的说明很容易!以以下命令为例。

$history | awk '{print }' | sort | uniq -c | sort -nr | head -5

对于新手和中级Linux用户而言,这有点难以理解。
对于那些想知道的人,上面的命令将显示Linux中最常用的命令。

如果要了解上述命令中各部分的说明,请使用以下命令启动Kmdr CLI:

$kmdr explain

Kmdr将提示我们输入命令。
只需键入它,然后按ENTER键。

输出示例:

? Enter your command: history | awk '{print }' | sort | uniq -c | sort -nr | head -5
history
With no options, display the command history list with line numbers.
|
A pipe serves the sdout of the previous command as input (stdin) to the next one
awk
pattern scanning and processing language
{print }
An argument
|
A pipe serves the sdout of the previous command as input (stdin) to the next one
sort
Sort lines of text files
|
A pipe serves the sdout of the previous command as input (stdin) to the next one
uniq
Report or omit repeated lines
-c, --count
Prefix lines by the number of occurrences
|
A pipe serves the sdout of the previous command as input (stdin) to the next one
sort
Sort lines of text files
-n, --numeric-sort
Compare according to string numerical value
-r, --reverse
Reverse the result of comparisons
|
A pipe serves the sdout of the previous command as input (stdin) to the next one
head
Output the first part of files
-5
An argument