Kmdr – Display CLI Commands Explanation In Terminal

A while ago, we wrote about ExplainShell , a web-based tool to learn what each part of a Linux command does. It divides the complex and lengthy Linux commands into multiple parts and gives explanation for each part. Using this tool, a Linux newbie can learn about various command line parameters and options without having to refer man pages. However, It will only help you to learn Linux commands. But what if you want to learn other CLI commands, for example Python? You won’t find explanation of Python commands in ExplainShell. No worries! Today, I stumbled upon a similar tool named Kmdr that provides CLI commands explanation for hundreds of programs. It helps you to easily learn CLI commands without leaving the terminal and without having to go through man pages. Not just Linux commands, Kmdr provides explanation for a lot of CLI commands including ansible , conda , docker , git , go , kubectl , mongo , mysql , npm , ruby gems , vagrant and hundreds of other programs such as those built into bash .

Kmdr can understand complex, long and sub-commands. It will also understand the commands that include piping, redirection, list constructs and other bash-builtins and operators. Kmdr gets you the explanation of wide range of programs, tools, and utilities.

  • Bash Shell Builtins (E.g. echo, export, cd).
  • Containers (E.g. Docker, kubectl).
  • Version Control (E.g. Git).
  • Database server and client (E.g. mysql, mongod).
  • Deployment / Cloud (E.g. now cloud).
  • File and Archiving tools (E.g. zip, tar).
  • Media ( E.g. ffmpeg, youtube-dl).
  • Network / Communication (E.g. netstat, nmap, curl).
  • Package managers (E.g. dpkg, pip).
  • Programming languages / Runtime environments / Compilers (E.g. go, python, node, gcc).
  • Sysadmin / Monitoring (E.g. crontab, top).
  • Text Processing (E.g. awk, sed).
  • Text editors (E.g. nano, vim).
  • Miscellaneous (E.g. openssl, bash, bash64).

You can view the complete list of supported programs here . The developers are adding more programs every day. Keep an eye on the list and do check it from time to time.

Kmdr is free, open source utility written in Nodejs .

Install Kmdr CLI

Kmdr requires Nodejs version 8.x or above. If you haven’t installed Nodejs on your Linux system yet, refer the following link.

After installing Nodejs, you can install Kmdr CLI with Npm package manager like below.

$ npm install [email protected] --global

Kmdr can also be directly used from your web browser. No installation or sign-up required! Just open your web browser and navigate to the following link and provide your command.

Display CLI Commands Explanation In Terminal Using Kmdr

Getting the explanation of a CLI command is easy! Take a following command as an example.

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

It is little bit difficult to understand for newbie and intermediate Linux users. For those wondering, the above command will display top most used commands in Linux.

If you want to know the explanation of each part in the above command, launch Kmdr CLI using command:

$ kmdr explain

Kmdr will prompt you to enter your command. Just type it and hit ENTER key.

Sample output:

? Enter your command: <strong>history | awk '{print $2}' | sort | uniq -c | sort -nr | head -5</strong>

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 $2}
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

   Did we help you better understand this command? (Use arrow keys)
❯ Skip & Exit 
──────────────
Yes 
No

Get CLI Commands Explanation From Terminal Using Kmdr

As you can see in the above output, Kmdr breaks down each part in the above command and gives the explanation of each part.

At the end of the explanation, Kmdr will ask you to share your feedback. You can choose Yes or No using arrow to send the feedback. If you choose Yes, just type the feedback and hit ENTER. If you don’t want to share the feedback, simply choose “Skip & Exit” to exit Kmdr. It’s that simple!

Kmdr understands multiple commands as well.

It’s also possible to get the explanation for commands with grouped options.

$ kmdr explain
? Enter your command: <strong>rsync -avz --exclude 'ostechnix' dir1/ dir2/</strong>

rsync
A fast, versatile, remote (and local) file-copying tool
-a, --archive
This is equivalent to -rlptgoD.
-v, --verbose
This option increases the amount of information you are given during the transfer.
-z, --compress
With this option, rsync compresses the file data as it is sent to the destination machine,which reduces the amount of data being transmitted -- something that is useful over a slow connection.
--exclude
This option is a simplified form of the --filter option that defaults to an exclude rule anddoes not allow the full rule-parsing syntax of normal filter rules.
ostechnix
An argument
dir1/
An argument
dir2/
An argument

   Did we help you better understand this command? (Use arrow keys)
❯ Skip & Exit 
──────────────
Yes 
No

I have given simple examples. You can try all sorts of complex commands that include piping, redirection, sub-commands, operators etc.

Suggested read:

After trying a couple commands, I noticed that Kmdr doesn’t has option to enter additional commands. I had to exit Kmdr and then enter another command again. It could be better if it allows me to add other commands without having to re-run “kmdr explain” every time. Apart from this minor issue, Kmdr works just fine on my Ubuntu 18.04 system.

Kmdr CLI client is very new and still in the early stage. I hope the developers will improve it by adding more features in the days to come. Give it a try and share your thoughts in the comment section below.

Resources:

我来评几句
登录后评论

已发表评论数()

相关站点

+订阅
热门文章