你们都知道,Linux 系统有很是多的命令,并且每一个命令又有很是多的用法,想要所有记住全部命令的全部用法,恐怕是一件不可能完成的任务。node
通常状况下,咱们学习一个命令时,要么直接百度去搜索它的用法,要么就直接用 man 命令去查看守冗长的帮助手册。这两个均可以实现咱们的目标,但有没有更简便的方式呢?python
答案是必须有的!今天给你们推荐一款有趣而实用学习神器 — kmdr
,让你解锁 Linux 学习新姿式。mysql
kmdr
工具最大的亮点就是,若是有一个长串命令你看不懂它的用法及意义,它将直接分模块给你详细解释!这个功能真的是很是实用,由于咱们在网上或书上不免会看到各类各样的命令,若是你看不懂,那将永远留下疑惑。而这个工具就像老师同样,按模块一个个告诉你命令各个部分的用法及意义,让你一目了然!git
kmdr
收纳了很是多的 CLI 命令解释,例如常见的 ansible, conda, docker, git, go, kubectl, mongo, mysql, npm, ruby gems, vagrant 等等,不只如此,那些 bash 内置命令 它都能为你解释,很是给力!程序员
无论你是哪一个领域的程序员,kmdr
都能最大限度地为你提供 CLI 命令学习帮助。github
这个连接里能够查看完整的支持列表:https://github.com/ediardo/km...web
kmdr
是用 Nodejs 编写的免费开源工具,须要 Nodejs 版本 8.x 或更高版本才能运行,须要你们先准备好运行环境。sql
安装好 Nodejs 以后,使用 Npm 软件包管理器安装 kmdr
:docker
$ npm install kmdr@latest --global
不想安装 Nodejs 这么麻烦?不要紧,这里有一个网站可让你在 web 浏览器直接使用 kmdr
↓↓
http://demo.kmdr.sh/数据库
下面咱们经过一条复杂点的命令做为例子,来看看 kmdr
究竟有多强!
$ history | awk '{print $2}' | sort | uniq -c | sort -nr | head -5
首先,运行下面的命令,让 kmdr
进入解释状态:
$ kmdr explain
接着,输入咱们上面的示例命令,而后按 ENTER 键:
? Enter your command: history | awk '{print $2}' | 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 $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
能够看到 kmdr
这个命令的强大之处,它将那条复杂命令中每一个部分的解释都给你列出来了,让你一目了然,一看就懂!
若是一个长串复杂命令里面包含了多个子命令,kmdr
也能够一个个为你解释。
还能够解释具备分组选项的命令。
$ kmdr explain ? Enter your command: rsync -avz --exclude 'liangxu' dir1/ dir2/ 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. liangxu An argument dir1/ An argument dir2/ An argument 🤖 Did we help you better understand this command? (Use arrow keys) ❯ Skip & Exit ────────────── Yes No
我的认为,查看 CLI 命令的帮助文档,一来其内容多而长,二来仔细去找会浪费时间和精力。而 kmdr
只要你输入你不懂的命令,直接就给你整明白,难道它不香吗?你们快点去试试吧。
-----------------
我是良许,世界500强外企 Linux 开发工程师,专业生产 Linux 干货。欢迎关注个人公众号「良许Linux」,里面分享了 Linux入门、基础、进阶 等系列教程,同时也有 Git、Vim、开源项目 等技术干货。