man?不,你需要cheat | Blurred code

man?不,你需要cheat

panda

2015/10/30

Updated:2015/10/30

Categories: linux

Linux界有一个经典的俗语,不懂就问男人。 即man命令。

但是,man实在是太冗长了。

比如 man tar

TAR(1) BSD General Commands Manual TAR(1)

NAME tar — The GNU version of the tar archiving utility

SYNOPSIS tar [-] A –catenate –concatenate | c –create | d –diff –compare | –delete | r –append | t –list | –test-label | u –update | x –extract –get [options] [pathname …]

DESCRIPTION Tar stores and extracts files from a tape or disk archive.

The first argument to tar should be a function; either one of the letters Acdrtux, or one of the long function names. A function letter need not be prefixed with ``-'', and may be combined with other single-letter options. A long function name must be prefixed with –. Some options take a parameter; with the single-letter form these must be given as separate arguments. With the long form, they may be given by appending =value to the option.

FUNCTION LETTERS Main operation mode:

-A, –catenate, –concatenate append tar files to an archive

-c, –create create a new archive

-d, –diff, –compare find differences between archive and file system

–delete delete from the archive (not on mag tapes!)

-r, –append append files to the end of an archive ——————————————————————————————————————————————————————————————————————————————————————————– 下面轮到cheat登场了。 cheat是在GNU通用公共许可证下,为Linux命令行用户发行的交互式备忘单应用程序。它提供显示Linux命令使用案例,包括该命令所有的选项和简短但尚可理解的功能。 简单的说,cheat将会直接举例告诉你,一个命令该怎么用。

简单一点,教你如何用man cheat man

Convert a man page to pdf

man -t bash | ps2pdf - bash.pdf

View the ascii chart

man 7 ascii

—————————————————————————————————————————————————————————————————————————————————————————— cheat如何安装 Cheat 依赖‘python’ 和 ‘pip’。 1.已有pip sudo pip install cheat 2.常规安装 sudo pip install docopt pygments #安装必要依赖docopt git clone https://github.com/chrisallenlane/cheat.git# 从仓库里面执行git clone,到~/cheat目录 cd ~/cheat #调整工作目录 sudo python setup.py install# 执行安装 现在应该可用了,打开命令提示符,输入cheat -v试一试? panda@NightWatch:~$ cheat -v cheat 2.1.18 ———————————————————————————————————————————————————————————————————————————————————————— 一.上面的还不够,为什么呢,因为cheat命令还不够好用,想象一下cheat +(一个十几个字母的命令),所以你还需要cheat自动补齐, 所幸官网上提供了bash脚本 wget https://github.com/chrisallenlane/cheat/raw/master/cheat/autocompletion/cheat.bash sudo mv cheat.bash /etc/bash_completion.d/ #需要root权限

如果终端不是bash,可以去https://github.com/chrisallenlane/cheat/tree/master/cheat/autocompletion 下载其他的脚本。

二。cheat支持自定义写一些备忘的命令。在编辑命令的时候需要调用编辑器,所以你需要再添加一行代码来指明需要的编辑器。另外 还可以添加代码高亮功能 vim ~/.bashrc #添加一行 export EDITOR = /usr/bin/nano #nano可以换为vi/gedit等自己熟悉的编辑器 #代码高亮,再添加一行 export CHEATCOLOR=true

想要建立备忘录的时候可以输入 cheat -e mynote #mynote为自己建立的备忘录名字

最后附上图一张

2015-10-30 21:00:05屏幕截图