How To Install The Command Line Cheat Sheet On Linux?
Introduction
Cheat is a python-based command reminder tool. Compared to lengthy and vague man and info pages, cheat provides distinct instructions to the options, arguments, or common uses of common commands. With cheat, system administrators can also edit existing cheat sheets or create custom cheat sheets for any subjects.
Cheat can be installed on all kinds of Unix-like systems. In this article, I will only demonstrate the steps on a CentOS server instance.
Prerequisites
Before moving on, you need to:
- Deploy a CentOS server instance with the LEMP application.
- Log in as a non-root user with sudo permissions. You can find how to create such a user in this tutorial.
How To Install The Command Line Cheat Sheet On Linux
Step one – Install pip and cheat
The easiest way to install cheat is with pip:
sudo yum update
sudo yum install -y python-devel python-setuptools python-pip
sudo pip install --upgrade pip
sudo pip install cheat
Step two – Configure cheat
Edit the current user’s .bashrc
file to specify the default editor for editing cheat sheets, and to enable syntax highlighting:
vi ~/.bashrc
Add the following two lines beneath the line “fi”:
export EDITOR=/usr/bin/vim
export CHEATCOLORS=true
Save and quit:
:wq
Put the changes into effect:
source ~/.bashrc
Step three – Use cheat
To view a cheat sheet:
cheat [xyz]
[xyz]
is the name of the command that you want to query.
To search a cheat sheet including your input [xyz]
:
cheat -s [xyz]
All of the related contents in cheat sheets that include the phrase [xyz]
will be displayed on the screen.
To list all of the available cheat sheets:
cheat -l
To edit an existing cheat sheet or to create a custom cheat sheet:
cheat -e [xyz]
To see the version of cheat program:
cheat -v
To see the store locations of cheat sheets:
cheat -d