{"id":1341,"date":"2014-09-30T14:49:26","date_gmt":"2014-09-30T14:49:26","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=1341"},"modified":"2014-09-30T14:49:26","modified_gmt":"2014-09-30T14:49:26","slug":"linux%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%ae%9e%e7%94%a8%e5%8a%a9%e8%ae%b0%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/1341.html","title":{"rendered":"Linux\u547d\u4ee4\u884c\u5b9e\u7528\u52a9\u8bb0\u5de5\u5177"},"content":{"rendered":"<p>\u5728segmentfault\u4e0a\u770b\u5230\u4e00\u7bc7\u540d\u4e3a\u201c<a href=\"http:\/\/segmentfault.com\/blog\/diggerplus\/1190000000691131\" target=\"_blank\">\uff3b\u6781\u5ba2\u5de5\u5177\uff3dcheat-linux\u547d\u4ee4\u884c\u5b9e\u7528\u52a9\u8bb0\u5de5\u5177<\/a>\u201d\u7684\u6587\u7ae0\uff0c\u6bd4\u8f83\u611f\u5174\u8da3\uff0c\u7136\u540e\u81ea\u5df1\u5b9e\u9645\u5b89\u88c5\u8bd5\u4e86\u8bd5\uff0c\u611f\u89c9\u8fd8\u884c\uff0c\u5728\u8fd9\u91cc\u63a8\u8350\u4e00\u4e0b\uff1a<\/p>\n<h5>\u76f8\u5173\u8bf4\u660e<\/h5>\n<p>\u867d\u7136Linux\u4e0b\u7684\u547d\u4ee4\u57fa\u672c\u4e0a\u90fd\u53ef\u4ee5\u5728man\/help\u4e2d\u627e\u5230\u8be6\u7ec6\u7528\u6cd5\uff0c\u4f46\u4e0d\u5f97\u4e0d\u8bf4\u2014\u2014\u4e0d\u591f\u76f4\u89c2\uff0c\u6211\u5c31\u662f\u60f3\u7528\u8fd9\u4e2a\u547d\u4ee4\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u4f60\u8ddf\u6211\u8bf4\u4e00\u5806\u80cc\u666f\u77e5\u8bc6\u6709\u6bdb\u7528\uff0c\u6211\u5c31\u662f\u60f3\u8981\u4e2a\u793a\u4f8b\uff0c\u6539\u6539\u7136\u540e\u7528\u5230\u6211\u81ea\u5df1\u7684\u547d\u4ee4\/\u811a\u672c\u4e2d\u6765\uff0c\u5728\u8fd9\u65b9\u9762cheat\u5c31\u53ef\u6bd4man\/help\u8981\u597d\u7528\u591a\u4e86\u3002\u6309\u7167cheat\u4f5c\u8005\u7684\u8bdd\u6765\u8bf4\u5c31\u662f\u201c<code>cheat<\/code> allows you to create and view interactive cheatsheets on the command-line. It was designed to help remind *nix system administrators of options for commands that they use frequently, but not frequently enough to remember.\uff08<span style=\"color: #ff0000;\">cheat\u547d\u4ee4\u5141\u8bb8\u4f60\u5728\u547d\u4ee4\u884c\u4e2d\u67e5\u770bor\u521b\u5efa\u4ea4\u4e92\u5f0f\u7684\u4f7f\u7528\u624b\u518c\u3001\u5b9e\u4f8b\uff0c\u76ee\u7684\u662f\u7528\u6765\u5e2e\u52a9Linux\u7cfb\u7edf\u7684\u7ba1\u7406\u5458\u64cd\u4f5c\u90a3\u4e9b\u4ed6\u4eec\u5e38\u4f1a\u7528\u5230\u4f46\u6ca1\u6709\u719f\u6089\u5230\u968f\u624b\u5c31\u6765\u7684\u547d\u4ee4<\/span>\uff09\u201d\uff0c\u53cd\u6b63\u786e\u5b9e\u8fd8\u662f\u80fd\u591f\u8d77\u5230\u4e00\u4e9b\u4f5c\u7528\u7684\uff0c\u4ee5\u540e\u5c31\u4e0d\u7528\u975e\u5f97Google\/Baidu\u53bb\u627e\u793a\u4f8b\u4e86\u3002<\/p>\n<h5>\u5b89\u88c5\u65b9\u6cd5<\/h5>\n<h6>1.\u4f7f\u7528pip<\/h6>\n<p>sudo pip install cheat<\/p>\n<h6>2.\u4f7f\u7528homebrew<\/h6>\n<p>sudo brew install cheat<\/p>\n<h6>3.\u624b\u52a8\u5b89\u88c5<\/h6>\n<p>\u5148\u5b89\u88c5\u4f9d\u8d56\uff1asudo pip install docopt pygments<\/p>\n<p>\u7136\u540e\uff1agit clone https:\/\/github.com\/chrisallenlane\/cheat.git &amp;&amp; cd cheat &amp;&amp; sudo python setup.py install<\/p>\n<h5>\u4f7f\u7528\u793a\u4f8b<\/h5>\n<h6>1.\u67e5\u770btar\u547d\u4ee4\u7684\u4f7f\u7528\u65b9\u6cd5<\/h6>\n<p>cheat tar<\/p>\n<h6>2.\u67e5\u770b\u90fd\u6709\u54ea\u4e9b\u547d\u4ee4\u7684\u793a\u4f8b<\/h6>\n<p>cheat -l<\/p>\n<h6>3.\u641c\u7d22\u662f\u5426\u5b58\u5728\u67d0\u4e2a\u547d\u4ee4\u7684\u4f7f\u7528\u5e2e\u52a9<\/h6>\n<p>cheat -s awk<\/p>\n<h6>4.\u4e2a\u6027\u5316\u5b9a\u5236<\/h6>\n<p>cheat -e xxoo \u00a0 \u00a0#\u8fd9\u91ccxxoo\u53ef\u4ee5\u662f\u4f60\u81ea\u5df1\u5b9a\u4e49\u7684\u547d\u4ee4\u522b\u540d\uff0c\u7136\u540e\u7f16\u8f91\u5b83\u7684\u4f7f\u7528\u793a\u4f8b\u3001\u5e2e\u52a9<\/p>\n<pre class=\"lang:default decode:true\">root@debian:~# cheat --help\ncheat\n\nUsage:\n  cheat &lt;cheatsheet&gt;\n  cheat -e &lt;cheatsheet&gt;\n  cheat -s &lt;keyword&gt;\n  cheat -l\n  cheat -d\n  cheat -v\n\ncheat allows you to create and view interactive cheatsheets on the\ncommand-line. It was designed to help remind *nix system\nadministrators of options for commands that they use frequently,\nbut not frequently enough to remember.\n\nExamples:\n  To look up 'tar':\n  cheat tar\n\n  To create or edit the cheatsheet for 'foo':\n  cheat -e foo\n\nOptions:\n  -d --directories  List directories on CHEATPATH\n  -e --edit         Edit cheatsheet\n  -l --list         List cheatsheets\n  -s --search       Search cheatsheets for &lt;keyword&gt;\n  -v --version      Print the version number\nroot@debian:~#\nroot@debian:~# cheat -l\n7z             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/7z\nab             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ab\napk            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/apk\napparmor       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/apparmor\napt-cache      \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/apt-cache\napt-get        \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/apt-get\naptitude       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/aptitude\nasciiart       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/asciiart\nasterisk       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/asterisk\nat             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/at\nawk            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/awk\nbash           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/bash\nchmod          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/chmod\nchown          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/chown\nconvert        \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/convert\ncrontab        \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/crontab\ncurl           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/curl\ncut            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/cut\ndate           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/date\ndd             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/dd\ndf             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/df\ndhclient       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/dhclient\ndiff           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/diff\ndistcc         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/distcc\nemacs          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/emacs\nfind           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/find\ngcc            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/gcc\ngdb            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/gdb\ngit            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/git\ngpg            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/gpg\ngrep           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/grep\ngs             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/gs\nhead           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/head\nhistory        \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/history\nifconfig       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ifconfig\nindent         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/indent\nip             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ip\niptables       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/iptables\nirssi          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/irssi\niwconfig       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/iwconfig\njournalctl     \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/journalctl\nless           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/less\nln             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ln\nls             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ls\nlsof           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/lsof\nmarkdown       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/markdown\nmkdir          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/mkdir\nmount          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/mount\nmysql          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/mysql\nmysqldump      \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/mysqldump\nncat           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ncat\nnetstat        \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/netstat\nnmap           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/nmap\nnotify-send    \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/notify-send\nod             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/od\nopenssl        \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/openssl\npacman         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/pacman\npdftk          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/pdftk\nphp            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/php\nps             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ps\npython         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/python\nrm             \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/rm\nrsync          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/rsync\nsam2p          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/sam2p\nscp            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/scp\nscreen         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/screen\nsed            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/sed\nshred          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/shred\nsockstat       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/sockstat\nsort           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/sort\nsplit          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/split\nsqlmap         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/sqlmap\nssh            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ssh\nssh-copy-id    \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ssh-copy-id\nssh-keygen     \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/ssh-keygen\nstdout         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/stdout\nstrace         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/strace\nsystemctl      \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/systemctl\ntail           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/tail\ntar            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/tar\ntcpdump        \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/tcpdump\ntee            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/tee\ntmux           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/tmux\ntop            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/top\ntruncate       \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/truncate\nuname          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/uname\nvim            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/vim\nwget           \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/wget\nxargs          \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/xargs\nyaourt         \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/yaourt\nyoutube-dl     \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/youtube-dl\nyum            \/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\/yum\n\nroot@debian:~# cheat -d\n\/root\/.cheat\n\/usr\/local\/lib\/python2.7\/dist-packages\/cheat\/cheatsheets\nroot@debian:~#\nroot@debian:~# cheat -s awk\nawk:\n  printf '1n2n3n' | awk '{ sum += $1} END {print sum}'\n\nfind:\n  find \/ -type f -size +20000k -exec ls -lh {} ; | awk '{ print $9 \": \" $5 }'\n\nhistory:\n  history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] \" \" CMD[a]\/count*100 \"% \" a;}' | grep -v \".\/\" | column -c3 -s \" \" -t | sort -nr | nl | head -n10\n\nnetstat:\n  netstat -pln | grep &lt;port&gt; | awk '{print $NF}'\n\nopenssl:\n  awk '\/-----BEGIN\/,\/END CERTIFICATE-----\/' | <\/pre>\n<h5>\u76f8\u5173\u9879\u76ee<\/h5>\n<ul class=\"task-list\">\n<li><a href=\"https:\/\/github.com\/lucaswerkmeister\/cheats\" target=\"_blank\">lucaswerkmeister\/cheats<\/a>: An implementation of this concept in pure bash that also allows not only for numerical indexing of subcomands but also supports running commands interactively.<\/li>\n<li><a href=\"https:\/\/github.com\/jahendrie\/cheat\" target=\"_blank\">jahendrie\/cheat<\/a>: A bash-only implementation that additionally allows for cheatsheets to be created and <code>grep<\/code> searched from the command-line. (<a href=\"https:\/\/github.com\/jahendrie\" target=\"_blank\">jahendrie<\/a> contributed key ideas to this project as well.)<\/li>\n<li><a href=\"http:\/\/errtheblog.com\/posts\/21-cheat\" target=\"_blank\"><code>cheat<\/code> RubyGem<\/a>: A clever gem from 2006 that clearly had similar motivations. It is unclear whether or not it is currently maintained.<\/li>\n<li><a href=\"https:\/\/github.com\/tldr-pages\/tldr\" target=\"_blank\"><code>tldr<\/code><\/a>: &#8220;Simplified and community-driven man pages&#8221;.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u660e\u5929\u5c3165\u5468\u5e74\u56fd\u5e86\u4e86\uff0c\u867d\u8bf4\u4e0d\u4e0a\u73ed\uff0c\u4f46\u662f\uff0c\u60f3\u60f3\u4e5f\u90fd\u77e5\u9053\u4eba\u5c71\u4eba\u6d77\u7684\u573a\u9762\u4f1a\u6709\u591a\u58ee\u89c2\uff0c\u5c31\u4e0d\u51fa\u53bb\u51d1\u8fd9\u4e2a\u70ed\u95f9\u4e86\uff0c\u5b85\u7740\u5427\uff08\u8fd8\u4e0d\u662f\u56e0\u4e3a\u6ca1\u94b1\uff0c\u6ca1\u6cd5\u53bb\u597d\u5730\u65b9\u73a9\uff0c\u54ce\uff0c\u8bf4\u591a\u4e86\u90fd\u662f\u6cea\u554a::&gt;_&lt;:: \uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728segmentfault\u4e0a\u770b\u5230\u4e00\u7bc7\u540d\u4e3a\u201c\uff3b\u6781\u5ba2\u5de5\u5177\uff3dcheat-linux\u547d\u4ee4\u884c\u5b9e\u7528\u52a9\u8bb0\u5de5\u5177\u201d\u7684\u6587\u7ae0\uff0c\u6bd4\u8f83\u611f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,12],"tags":[358,30],"class_list":["post-1341","post","type-post","status-publish","format-standard","hentry","category-other","category-tools","tag-cheat","tag-linux"],"views":2510,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=1341"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1341\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=1341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=1341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=1341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}