你們都知道,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、開源項目 等技術乾貨。