Home » Hacks » Cheat: your portable memory bank

Cheat: your portable memory bank

How often do you find yourself scratching your head, trying to remember a command that you knew by heart but just can’t remember when you need it most?

It happens to me quite often. Probably because I am aging or may be there is too much stuff in my brain attic.

But I found a solution to that and it’s called Cheat.

Cheat is a beautiful light weight piece of software .. Here is the excerpt from the Github documentation page for what it does.

 

“Cheat allows you to create and view interactive cheat sheets 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.”

 

Cheat comes with a big list of *nix cheat sheets for all the basic commands, so it’s usable and useful out of box and that’s good news :). The great news is that you can extend it very easily from the CLI. I personally use it on a MAC and Linux and it’s working like a charm.

I basically try to get myself into the habit of creating such sheets for whatever operations I do from time to time but not regular enough to keep them fresh in my mind.

Cheat is python based but I it was also ported to different languages as well. Check out the documentation on github page here https://github.com/chrisallenlane/cheat but below is my quick guide.

Installing cheat:

To install cheat, you can clone the Github repository or just use pip to install the python version as below

[wael-lt:~/workspace] wael% sudo pip install cheat
List available cheat sheets:

You have a ton here to start with, start adding your networking ones and make it yours.

[wael-lt:~/workspace] wael% cheat -l
7z               /Library/Python/2.7/site-packages/cheat/cheatsheets/7z
ab               /Library/Python/2.7/site-packages/cheat/cheatsheets/ab
apk              /Library/Python/2.7/site-packages/cheat/cheatsheets/apk
apparmor         /Library/Python/2.7/site-packages/cheat/cheatsheets/apparmor
apt              /Library/Python/2.7/site-packages/cheat/cheatsheets/apt
apt-cache        /Library/Python/2.7/site-packages/cheat/cheatsheets/apt-cache
apt-get          /Library/Python/2.7/site-packages/cheat/cheatsheets/apt-get
aptitude         /Library/Python/2.7/site-packages/cheat/cheatsheets/aptitude
..... output truncated......
show specific cheat sheet:
[wael-lt:~/workspace] wael% cheat vim
# File management

:e              reload file
:q              quit
:q!             quit without saving changes
:w              write file
:w {file}       write new file
:x              write file and exit
Edit or Create a new cheat sheet:

you just need to set your EDITOR environment variable for whatever texteditor you are using.

[wael-lt:~/workspace] wael% export EDITOR=nano
[wael-lt:~/workspace] wael% cheat -e 
Getting help:
[wael-lt:~/workspace/] wael% cheat --help
cheat

Usage:
  cheat 
  cheat -e 
  cheat -s 
  cheat -l
  cheat -d
  cheat -v

I like simple things and cheat is one simple thing that I love and is giving my memory a boost. Give it a try yourself.

Other implementations:

“I consider that a man’s brain originally is like a little empty attic, and you have to stock it with such furniture as you choose. A fool takes in all the lumber of every sort that he comes across, so that the knowledge which might be useful to him gets crowded out, or at best is jumbled up with a lot of other things, so that he has a difficulty in laying his hands upon it. Now the skillful workman is very careful indeed as to what he takes into his brain-attic. He will have nothing but the tools which may help him in doing his work, but of these he has a large assortment, and all in the most perfect order. It is a mistake to think that that little room has elastic walls and can distend to any extent. Depend upon it there comes a time when for every addition of knowledge you forget something that you knew before. It is of the highest importance, therefore, not to have useless facts elbowing out the useful ones.”
— Arthur Conan Doyle, A Study in Scarlet

3 comments

  1. I started using it :)

  2. It’s such a nice tool, I have been using for a while.

Leave a Reply

Your email address will not be published. Required fields are marked *