概述
cheat命令简单来说,就是告诉你一个命令如何使用。它没有提供其他额外多余的信息,只通过使用实例告诉你一个命令如何使用。比起man跟help来说,更通俗易懂。下面我们来说说cheat这个命令的安装
cheat命令依赖于Python和pip,因此,在安装cheat命令之前,你需要在机器上安装python和pip
1、安装依赖
yum install python python-pip git -y
PS: 如果遇到“No package XXX available”这样的报错的话,有可能是下面两个方面的原因
1. DNS问题,查看DNS是否可以成功解析
2. 镜像链接错误,如果是镜像链接错误的话,尝试下面操作:
sudo yum install epel-release
如还是报错的话,需要手动安装epel
cd /tmp wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ls*.rpm sudo yum install epel-release-7.noarch.rpm
注意:安装epel版本需要与CentOS版本一致,否则安装失败。即CentOS7版本对应的epel7版本
rpm安装完后,rpm -ql epel*,确提示未安装,此时要导入rpm的签名信息
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #(root身份执行)
安装完epel后,再尝试安装刚才未安装的包
2、 安装python依赖文件
pip install docopt pygments
3、 从github克隆cheat到本地
cd /tmp git clone https://github.com/chrisallenlane/cheat.git
4、 安装cheat
cd cheat python setup.py install
5、 查看版本号,是否安装正确
cheat -v cheat 2.1.27
6、 配置cheat
6.1、 添加editor环境变量
编辑~/.bashrc文件,添加下面内容并保存
export EDITOR=/usr/bin/nano
修改生效
source ~/.bashrc
6.2、为cheat命令添加自动补全功能
wget https://github.com/chrisallenlane/cheat/raw/master/cheat/autocompletion/cheat.bash mv cheat.bash /etc/bash_completion.d/
6.3、高亮显示(可选)
编辑你的.bashrc文件,添加添加下面内容并保存
export CHEATCOLORS=true
7、查看所有可用的cheat命令
cheat -l 7z /usr/lib/python2.7/site-packages/cheat/cheatsheets/7z ab /usr/lib/python2.7/site-packages/cheat/cheatsheets/ab ansi /usr/lib/python2.7/site-packages/cheat/cheatsheets/ansi apk /usr/lib/python2.7/site-packages/cheat/cheatsheets/apk apparmor /usr/lib/python2.7/site-packages/cheat/cheatsheets/apparmor apt /usr/lib/python2.7/site-packages/cheat/cheatsheets/apt apt-cache /usr/lib/python2.7/site-packages/cheat/cheatsheets/apt-cache apt-get /usr/lib/python2.7/site-packages/cheat/cheatsheets/apt-get aptitude /usr/lib/python2.7/site-packages/cheat/cheatsheets/aptitude aria2c /usr/lib/python2.7/site-packages/cheat/cheatsheets/aria2c asciiart /usr/lib/python2.7/site-packages/cheat/cheatsheets/asciiart asterisk /usr/lib/python2.7/site-packages/cheat/cheatsheets/asterisk at /usr/lib/python2.7/site-packages/cheat/cheatsheets/at awk /usr/lib/python2.7/site-packages/cheat/cheatsheets/awk bash /usr/lib/python2.7/site-packages/cheat/cheatsheets/bash bower /usr/lib/python2.7/site-packages/cheat/cheatsheets/bower bzip2 /usr/lib/python2.7/site-packages/cheat/cheatsheets/bzip2 chmod /usr/lib/python2.7/site-packages/cheat/cheatsheets/chmod chown /usr/lib/python2.7/site-packages/cheat/cheatsheets/chown convert /usr/lib/python2.7/site-packages/cheat/cheatsheets/convert cpdf /usr/lib/python2.7/site-packages/cheat/cheatsheets/cpdf crontab /usr/lib/python2.7/site-packages/cheat/cheatsheets/crontab csplit /usr/lib/python2.7/site-packages/cheat/cheatsheets/csplit cups /usr/lib/python2.7/site-packages/cheat/cheatsheets/cups curl /usr/lib/python2.7/site-packages/cheat/cheatsheets/curl cut /usr/lib/python2.7/site-packages/cheat/cheatsheets/cut date /usr/lib/python2.7/site-packages/cheat/cheatsheets/date dd /usr/lib/python2.7/site-packages/cheat/cheatsheets/dd deb /usr/lib/python2.7/site-packages/cheat/cheatsheets/deb df /usr/lib/python2.7/site-packages/cheat/cheatsheets/df dhclient /usr/lib/python2.7/site-packages/cheat/cheatsheets/dhclient diff /usr/lib/python2.7/site-packages/cheat/cheatsheets/diff distcc /usr/lib/python2.7/site-packages/cheat/cheatsheets/distcc dnf /usr/lib/python2.7/site-packages/cheat/cheatsheets/dnf docker /usr/lib/python2.7/site-packages/cheat/cheatsheets/docker dpkg /usr/lib/python2.7/site-packages/cheat/cheatsheets/dpkg du /usr/lib/python2.7/site-packages/cheat/cheatsheets/du emacs /usr/lib/python2.7/site-packages/cheat/cheatsheets/emacs ffmpeg /usr/lib/python2.7/site-packages/cheat/cheatsheets/ffmpeg find /usr/lib/python2.7/site-packages/cheat/cheatsheets/find for /usr/lib/python2.7/site-packages/cheat/cheatsheets/for gcc /usr/lib/python2.7/site-packages/cheat/cheatsheets/gcc gdb /usr/lib/python2.7/site-packages/cheat/cheatsheets/gdb git /usr/lib/python2.7/site-packages/cheat/cheatsheets/git gpg /usr/lib/python2.7/site-packages/cheat/cheatsheets/gpg grep /usr/lib/python2.7/site-packages/cheat/cheatsheets/grep gs /usr/lib/python2.7/site-packages/cheat/cheatsheets/gs gzip /usr/lib/python2.7/site-packages/cheat/cheatsheets/gzip hardware-info /usr/lib/python2.7/site-packages/cheat/cheatsheets/hardware-info head /usr/lib/python2.7/site-packages/cheat/cheatsheets/head history /usr/lib/python2.7/site-packages/cheat/cheatsheets/history http /usr/lib/python2.7/site-packages/cheat/cheatsheets/http hub /usr/lib/python2.7/site-packages/cheat/cheatsheets/hub ifconfig /usr/lib/python2.7/site-packages/cheat/cheatsheets/ifconfig indent /usr/lib/python2.7/site-packages/cheat/cheatsheets/indent ip /usr/lib/python2.7/site-packages/cheat/cheatsheets/ip iptables /usr/lib/python2.7/site-packages/cheat/cheatsheets/iptables irssi /usr/lib/python2.7/site-packages/cheat/cheatsheets/irssi iwconfig /usr/lib/python2.7/site-packages/cheat/cheatsheets/iwconfig journalctl /usr/lib/python2.7/site-packages/cheat/cheatsheets/journalctl jq /usr/lib/python2.7/site-packages/cheat/cheatsheets/jq jrnl /usr/lib/python2.7/site-packages/cheat/cheatsheets/jrnl less /usr/lib/python2.7/site-packages/cheat/cheatsheets/less lib /usr/lib/python2.7/site-packages/cheat/cheatsheets/lib ln /usr/lib/python2.7/site-packages/cheat/cheatsheets/ln ls /usr/lib/python2.7/site-packages/cheat/cheatsheets/ls lsof /usr/lib/python2.7/site-packages/cheat/cheatsheets/lsof lvm /usr/lib/python2.7/site-packages/cheat/cheatsheets/lvm man /usr/lib/python2.7/site-packages/cheat/cheatsheets/man markdown /usr/lib/python2.7/site-packages/cheat/cheatsheets/markdown mdadm /usr/lib/python2.7/site-packages/cheat/cheatsheets/mdadm mkdir /usr/lib/python2.7/site-packages/cheat/cheatsheets/mkdir more /usr/lib/python2.7/site-packages/cheat/cheatsheets/more mount /usr/lib/python2.7/site-packages/cheat/cheatsheets/mount mysql /usr/lib/python2.7/site-packages/cheat/cheatsheets/mysql mysqldump /usr/lib/python2.7/site-packages/cheat/cheatsheets/mysqldump nc /usr/lib/python2.7/site-packages/cheat/cheatsheets/nc ncat /usr/lib/python2.7/site-packages/cheat/cheatsheets/ncat ncdu /usr/lib/python2.7/site-packages/cheat/cheatsheets/ncdu netstat /usr/lib/python2.7/site-packages/cheat/cheatsheets/netstat nkf /usr/lib/python2.7/site-packages/cheat/cheatsheets/nkf nmap /usr/lib/python2.7/site-packages/cheat/cheatsheets/nmap nmcli /usr/lib/python2.7/site-packages/cheat/cheatsheets/nmcli notify-send /usr/lib/python2.7/site-packages/cheat/cheatsheets/notify-send nova /usr/lib/python2.7/site-packages/cheat/cheatsheets/nova npm /usr/lib/python2.7/site-packages/cheat/cheatsheets/npm ntp /usr/lib/python2.7/site-packages/cheat/cheatsheets/ntp numfmt /usr/lib/python2.7/site-packages/cheat/cheatsheets/numfmt od /usr/lib/python2.7/site-packages/cheat/cheatsheets/od openssl /usr/lib/python2.7/site-packages/cheat/cheatsheets/openssl org-mode /usr/lib/python2.7/site-packages/cheat/cheatsheets/org-mode p4 /usr/lib/python2.7/site-packages/cheat/cheatsheets/p4 pacman /usr/lib/python2.7/site-packages/cheat/cheatsheets/pacman paste /usr/lib/python2.7/site-packages/cheat/cheatsheets/paste patch /usr/lib/python2.7/site-packages/cheat/cheatsheets/patch pdftk /usr/lib/python2.7/site-packages/cheat/cheatsheets/pdftk php /usr/lib/python2.7/site-packages/cheat/cheatsheets/php ping /usr/lib/python2.7/site-packages/cheat/cheatsheets/ping ping6 /usr/lib/python2.7/site-packages/cheat/cheatsheets/ping6 pip /usr/lib/python2.7/site-packages/cheat/cheatsheets/pip pkgtools /usr/lib/python2.7/site-packages/cheat/cheatsheets/pkgtools ps /usr/lib/python2.7/site-packages/cheat/cheatsheets/ps python /usr/lib/python2.7/site-packages/cheat/cheatsheets/python readline /usr/lib/python2.7/site-packages/cheat/cheatsheets/readline rename /usr/lib/python2.7/site-packages/cheat/cheatsheets/rename rm /usr/lib/python2.7/site-packages/cheat/cheatsheets/rm route /usr/lib/python2.7/site-packages/cheat/cheatsheets/route rpm /usr/lib/python2.7/site-packages/cheat/cheatsheets/rpm rpm2cpio /usr/lib/python2.7/site-packages/cheat/cheatsheets/rpm2cpio rss2email /usr/lib/python2.7/site-packages/cheat/cheatsheets/rss2email rsync /usr/lib/python2.7/site-packages/cheat/cheatsheets/rsync sam2p /usr/lib/python2.7/site-packages/cheat/cheatsheets/sam2p scp /usr/lib/python2.7/site-packages/cheat/cheatsheets/scp screen /usr/lib/python2.7/site-packages/cheat/cheatsheets/screen sed /usr/lib/python2.7/site-packages/cheat/cheatsheets/sed shred /usr/lib/python2.7/site-packages/cheat/cheatsheets/shred smbclient /usr/lib/python2.7/site-packages/cheat/cheatsheets/smbclient snmpwalk /usr/lib/python2.7/site-packages/cheat/cheatsheets/snmpwalk sockstat /usr/lib/python2.7/site-packages/cheat/cheatsheets/sockstat sort /usr/lib/python2.7/site-packages/cheat/cheatsheets/sort split /usr/lib/python2.7/site-packages/cheat/cheatsheets/split sport /usr/lib/python2.7/site-packages/cheat/cheatsheets/sport sqlite3 /usr/lib/python2.7/site-packages/cheat/cheatsheets/sqlite3 sqlmap /usr/lib/python2.7/site-packages/cheat/cheatsheets/sqlmap ss /usr/lib/python2.7/site-packages/cheat/cheatsheets/ss ssh /usr/lib/python2.7/site-packages/cheat/cheatsheets/ssh ssh-copy-id /usr/lib/python2.7/site-packages/cheat/cheatsheets/ssh-copy-id ssh-keygen /usr/lib/python2.7/site-packages/cheat/cheatsheets/ssh-keygen stdout /usr/lib/python2.7/site-packages/cheat/cheatsheets/stdout strace /usr/lib/python2.7/site-packages/cheat/cheatsheets/strace svn /usr/lib/python2.7/site-packages/cheat/cheatsheets/svn systemctl /usr/lib/python2.7/site-packages/cheat/cheatsheets/systemctl systemd /usr/lib/python2.7/site-packages/cheat/cheatsheets/systemd tail /usr/lib/python2.7/site-packages/cheat/cheatsheets/tail tar /usr/lib/python2.7/site-packages/cheat/cheatsheets/tar tcpdump /usr/lib/python2.7/site-packages/cheat/cheatsheets/tcpdump tee /usr/lib/python2.7/site-packages/cheat/cheatsheets/tee tmux /usr/lib/python2.7/site-packages/cheat/cheatsheets/tmux top /usr/lib/python2.7/site-packages/cheat/cheatsheets/top tr /usr/lib/python2.7/site-packages/cheat/cheatsheets/tr trashy /usr/lib/python2.7/site-packages/cheat/cheatsheets/trashy tree /usr/lib/python2.7/site-packages/cheat/cheatsheets/tree truncate /usr/lib/python2.7/site-packages/cheat/cheatsheets/truncate udisksctl /usr/lib/python2.7/site-packages/cheat/cheatsheets/udisksctl uname /usr/lib/python2.7/site-packages/cheat/cheatsheets/uname uniq /usr/lib/python2.7/site-packages/cheat/cheatsheets/uniq unzip /usr/lib/python2.7/site-packages/cheat/cheatsheets/unzip urpm /usr/lib/python2.7/site-packages/cheat/cheatsheets/urpm vagrant /usr/lib/python2.7/site-packages/cheat/cheatsheets/vagrant vim /usr/lib/python2.7/site-packages/cheat/cheatsheets/vim virtualenv /usr/lib/python2.7/site-packages/cheat/cheatsheets/virtualenv weechat /usr/lib/python2.7/site-packages/cheat/cheatsheets/weechat wget /usr/lib/python2.7/site-packages/cheat/cheatsheets/wget xargs /usr/lib/python2.7/site-packages/cheat/cheatsheets/xargs xmlto /usr/lib/python2.7/site-packages/cheat/cheatsheets/xmlto xrandr /usr/lib/python2.7/site-packages/cheat/cheatsheets/xrandr xxd /usr/lib/python2.7/site-packages/cheat/cheatsheets/xxd yaourt /usr/lib/python2.7/site-packages/cheat/cheatsheets/yaourt youtube-dl /usr/lib/python2.7/site-packages/cheat/cheatsheets/youtube-dl yum /usr/lib/python2.7/site-packages/cheat/cheatsheets/yum zip /usr/lib/python2.7/site-packages/cheat/cheatsheets/zip zoneadm /usr/lib/python2.7/site-packages/cheat/cheatsheets/zoneadm
8、cheat使用
cheat mkdir # Create a directory and all its parents mkdir -p foo/bar/baz # Create foo/bar and foo/baz directories mkdir -p foo/{bar,baz} # Create the foo/bar, foo/baz, foo/baz/zip and foo/baz/zap directories mkdir -p foo/{bar,baz/{zip,zap}}
转载于:https://blog.51cto.com/hooper/1895664
最后
以上就是端庄星星为你收集整理的cheat命令的安装&No package XXX available报错的解决方法的全部内容,希望文章能够帮你解决cheat命令的安装&No package XXX available报错的解决方法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复