Linux命令学习神器!命令看不懂直接给你解释!

系统 Linux
今天给大家推荐一款有趣而实用学习神器 — kmdr,让你解锁 Linux 学习新姿势。

 [[383166]]

大家都知道,Linux 系统有非常多的命令,而且每个命令又有非常多的用法,想要全部记住所有命令的所有用法,恐怕是一件不可能完成的任务。

一般情况下,我们学习一个命令时,要么直接百度去搜索它的用法,要么就直接用 man 命令去查看守冗长的帮助手册。这两个都可以实现我们的目标,但有没有更简便的方式呢?

答案是必须有的!今天给大家推荐一款有趣而实用学习神器 — kmdr,让你解锁 Linux 学习新姿势。

kmdr 工具最大的亮点就是,如果有一个长串命令你看不懂它的用法及意义,它将直接分模块给你详细解释!这个功能真的是非常实用,因为我们在网上或书上难免会看到各种各样的命令,如果你看不懂,那将永远留下疑惑。而这个工具就像老师一样,按模块一个个告诉你命令各个部分的用法及意义,让你一目了然!

kmdr 收纳了非常多的 CLI 命令解释,例如常见的 ansible, conda, docker, git, go, kubectl, mongo, mysql, npm, ruby gems, vagrant 等等,不仅如此,那些 bash 内置命令 它都能为你解释,非常给力!

不管你是哪个领域的程序员,kmdr 都能最大限度地为你提供 CLI 命令学习帮助。

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

这个链接里可以查看完整的支持列表:https://github.com/ediardo/kmdr-cli#supported-programs)

安装 Kmdr CLI

kmdr 是用 Nodejs 编写的免费开源工具,需要 Nodejs 版本 8.x 或更高版本才能运行,需要大家先准备好运行环境。

安装好 Nodejs 之后,使用 Npm 软件包管理器安装  kmdr: 

  1. $ npm install kmdr@latest --global 

不想安装 Nodejs 这么麻烦?没关系,这里有一个网站可以让你在 web 浏览器直接使用 kmdr ↓↓  

http://demo.kmdr.sh/

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

下面我们通过一条复杂点的命令作为例子,来看看 kmdr 究竟有多强! 

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

首先,运行下面的命令,让 kmdr 进入解释状态: 

  1. $ kmdr explain 

接着,输入我们上面的示例命令,然后按 ENTER 键: 

  1. ? Enter your command: history | awk '{print $2}' | sort | uniq -c | sort -nr | head -5  
  2. history  
  3. With no options, display the command history list with line numbers.  
  4.  
  5. A pipe serves the sdout of the previous command as input (stdin) to the next one  
  6. awk  
  7. pattern scanning and processing language  
  8. {print $2}  
  9. An argument  
  10.  
  11. A pipe serves the sdout of the previous command as input (stdin) to the next one  
  12. sort  
  13. Sort lines of text files  
  14.  
  15. A pipe serves the sdout of the previous command as input (stdin) to the next one  
  16. uniq  
  17. Report or omit repeated lines  
  18. -c, --count  
  19. Prefix lines by the number of occurrences  
  20.  
  21. A pipe serves the sdout of the previous command as input (stdin) to the next one  
  22. sort  
  23. Sort lines of text files  
  24. -n, --numeric-sort  
  25. Compare according to string numerical value  
  26. -r, --reverse 
  27.  Reverse the result of comparisons  
  28.  
  29. A pipe serves the sdout of the previous command as input (stdin) to the next one  
  30. head  
  31. Output the first part of files  
  32. -5  
  33. An argument  
  34. 🤖 Did we help you better understand this command? (Use arrow keys)  
  35. ❯ Skip & Exit   
  36. ──────────────  
  37. Yes   
  38. No 

可以看到 kmdr 这个命令的强大之处,它将那条复杂命令中每个部分的解释都给你列出来了,让你一目了然,一看就懂!

如果一个长串复杂命令里面包含了多个子命令,kmdr 也可以一个个为你解释。

还可以解释具有分组选项的命令。 

  1. $ kmdr explain  
  2. ? Enter your command: rsync -avz --exclude 'liangxu' dir1/ dir2/  
  3. rsync  
  4. A fast, versatile, remote (and local) file-copying tool  
  5. -a, --archive  
  6. This is equivalent to -rlptgoD.  
  7. -v, --verbose  
  8. This option increases the amount of information you are given during the transfer.  
  9. -z, --compress  
  10. 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. 
  11. --exclude  
  12. 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. 
  13. liangxu  
  14. An argument  
  15. dir1/  
  16. An argument  
  17. dir2/  
  18. An argument  
  19. 🤖 Did we help you better understand this command? (Use arrow keys)  
  20. ❯ Skip & Exit   
  21. ──────────────  
  22. Yes   
  23. No 

总结

个人认为,查看 CLI 命令的帮助文档,一来其内容多而长,二来仔细去找会浪费时间和精力。而 kmdr 只要你输入你不懂的命令,直接就给你整明白,难道它不香吗?大家快点去试试吧。 

 

责任编辑:庞桂玉 来源: Linux学习
相关推荐

2022-02-07 09:05:00

GitHub功能AI

2019-12-09 08:29:26

Netty架构系统

2022-12-12 07:40:36

服务器项目Serverless

2024-02-27 18:09:22

Linux命令glow

2022-07-26 14:38:08

JavaScriptWeb安全自动化

2023-06-30 08:01:04

Reactuse关键词

2020-03-30 16:45:06

代码看不懂

2022-06-16 14:07:26

Java代码代码review

2021-12-09 11:59:49

JavaScript前端提案

2021-12-24 10:15:22

Linux命令lsof

2020-03-06 11:30:08

JavaGitHub编程

2014-03-12 09:25:33

产品经理Startup

2015-07-28 10:31:48

2017-09-19 15:45:39

2020-11-06 08:36:04

UI设计规范iOS

2020-09-21 13:06:58

TikTok网络安全隐私

2013-07-08 10:49:03

程序员代码看懂代码

2014-08-05 11:38:57

linux

2019-11-18 14:45:13

代码开发工具

2017-06-16 09:22:22

数据结构算法链表
点赞
收藏

51CTO技术栈公众号