I got a frenzied e-mail the other day insisting that I add “cheat” to the remaining titles in the C section. I agreed, but was a little surprised to see that it was a different “cheat” than what I had added months earlier.
So there are a lot of cheats out there. Here is the one I was sent a few days ago. … I think. … 😳
It’s a simple enough principle: Chris Lane’s cheat keeps a directory of text files, and calling “cheat” dumps them to the screen. In essence you have a healthy collection of cheatsheets with quick-fire display options.
What you put in a sheet is up to you; as Chris mentions, you could do just as well to keep recipes, inspirational quotes or bank account numbers in there. cheat itself doesn’t really know the difference.
Chris Lane’s cheat can accept a few external variables, such as a specific path to cheat files, or syntax coloring. Those can be helpful.
Here’s the cheat that I had found a few months ago, that is supposedly built to mimic Chris’s version.
It’s very similar, as you can see, and the real difference — as I understand it — is that jahendrie’s version is a bash rewrite, whereas Chris Lane’s original was made for python.
There are some special differences here and there; jahendrie’s version has a search option that seems to work differently from Chris’s. jahendrie also allows an in-file grep option, which might be preferable under some circumstances.
It’s very difficult for me to tell between Chris’s and jahendrie’s cheat. They work much the same and carry some similar options. I did notice that Chris’s version came bundled with cheatsheets for many terminal commands, but jahendrie’s apparently doesn’t. Please correct me if I’m wrong.
Here’s one more, this time called “cheats,” just to round out the trifecta.
There are some subtle differences here, which might not be obvious just from a screenshot. First, cheats allows for several cheatsheets on the same topic, with slightly different names. What you see as “dd 1” and “dd 2” came out of different files.
Second, and more importantly, cheats is a bash-only version with a very clever addition: the ability to actually prompt through a cheat, and build the command step-by-step. Finish the prompts, and cheats will run the command as you built it.
So in that sense, cheats takes the ideas shown in cheat and cheat one step further, and saves you retyping the reminder off the screen, or plunking around with testing options. It’s a nice touch, and would be useful for beginners in particular.
By default, cheats comes with a few examples for dd, du, git, sort, tar and a few others. You’ll have to add and build more, if you really want to flesh out your collection.
As a bonus, here’s cheat for ruby, which I found while trying to untangle the last three in my mind. 😐
I’m not a ruby programmer, so I have a feeling that a lot of what ruby-cheat offers is outside my grasp. On the other hand, ruby-cheat seems to know enough to dump its output straight into $PAGER, and let you navigate from there.
I won’t judge the ruby edition of cheat too harshly (in fact, not at all), since again, it’s not something I have a direct application for. Then again, when has that ever stopped me … ?
For what it’s worth, I have my own system for command-line cheats, and I would guess it’s similar to something you might have invented on your own. I keep a single text file with a list of sometimes-used-but-not-intuitive commands, and grep through them when I can’t remember the exact syntax.
It’s primitive, but it also allows me the freedom of pumping the command directly into the console, with help of eval. In short,
eval $(grep exif hold/cmd.txt ) usually triggers a command, if I want it.
As a side note, I am admittedly a person who learns by experimenting with other people’s examples. It’s just my nature. To that end, you would think that something like cheat or cheat or cheats or cheat would be a quick adoption for me.
But I don’t know that any of these — cheats included, and that would probably be the one I would keep — is much more help than a decent man page. True, in a perfect world, every man page would include a few examples, and this is not a perfect world.
But I have a feeling these are only as useful as you make them. Pick any one and add a little of your own expertise to its database, and it will be a valuable addition. Of course, I could say that about everything. … 🙄