Cheatsheets and KB

Posted on July 1, 2021 by Adrian Wyssmann ‐ 4 min read

Until know I have my own cheatsheet section in may website. Even so writing them helped me to memorize some stuff, they are far from complete. Thus I decided to drop them in favor of community driven solutions.

I recently found some cool open source tools which help you to have cheatsheets and manage your kb. I played around with them and here is what I found. The tools below focus on helping remind you of frequently used commands which may be hard to remember, but without you have to go trough the man pages.

Cheats

cheat is a tool that allows you to create and view interactive cheatsheets on the command-line. The usage is simple:

cheats example

There are some community driven cheatsheets available, but you can add your own selection of cheatsheets, by using different “cheatpaths” i.e. different directories that contain cheatsheets. This is configured in the conf.yml which can point to different repositories

# conf.yml:
# ...
cheatpaths:
  - name: community                   # a name for the cheatpath
    path: ~/documents/cheat/community # the path's location on the filesystem
    tags: [ community ]               # these tags will be applied to all sheets on the path
    readonly: true                    # if true, `cheat` will not create new cheatsheets here

  - name: personal
    path: ~/documents/cheat/personal  # this is a separate directory and repository than above
    tags: [ personal ]
    readonly: false                   # new sheets may be written here
# ...

So for example I add a new file /home/aedu/.cheat/cheatsheets/personal/demo with the following content:

## Demo example

this is a [test](https://google.com)

I can then query my cheatsheet:

$ cheat demo
## Demo example

this is a [test](https://google.com)

Some notes:

  • Community cheatsheets must be installed separately, though you may have downloaded them automatically when installing ‘cheat’
  • The cheatsheets are simple texts no md (in comparison to tldr)
  • Personal cheatsheets takes precendence over community cheatsheets
  • It has shell autocompletion available for bash, fish, and zsh.

TLDR

tldr is similar to cheat, but the content is also browseable via https://tldr.sh/. The usage is similar:

tldr example

The actual cheatsheets seem bundeled together with the app itself, which is a main difference to cheat.

Some things to note:

  • The project is community-governed (in comparison to cheat which governed by chrisallenlane)
  • There are multiple clients available, which makes it more widely available.
  • It uses markdown.
  • It supports multi-lingual cheatsheets

eg

eg is very similar to cheat and it also allows to have community driven examples as well as your own. Btw. in my case I had a conflict, as go-tools already brings a tool called eg:

error: failed to commit transaction (conflicting files)
eg: /usr/bin/eg exists in filesystem (owned by go-tools)
Errors occurred, no packages were upgraded.

However, this can be fixed by either de-installing go-tools or install the eg from source and make a different symlink. Once it’s installed, the output looks like this:

eg example

The content for the search lives in the examples/ folder. You can however, define your own folder - ideally done in the config file which you have to create:

[eg-config]
examples-dir = ~/examples-dir
custom-dir = ~/my/fancy/custom/dir

The config file is looked for first at ${XDG_CONFIG_HOME}/eg/egrc and then at ~/.egrc. Also other aspects are highly configurable.

kb

kb is a minimalist command-line knowledge base manager, to organize your notes and cheatsheets. The cool thing is, that it also does support non-text files but also images, pdf, videos and others:

kb example

kb is slghtly different than the above programs, as it focuses on organizing your knowledge, and not only provide cheatsheets:

  • collect items containing notes,guides,procedures,cheatsheets into an organized knowledge base;
  • filter the knowledge base on different metadata: title, category, tags and others;
  • visualize items within the knowledge base with (or without) syntax highlighting;
  • grep through the knowledge base using regexes;
  • import/export an entire knowledge base;

Checkout README as it shows some examples on how to use it.

devhints

devhints or “Rico’s cheatsheets” is not a program but a website, which offers cheatsheets not only for command line tools but also for programming languages etc. The source code can be found here

What is my take?

All of these projects are very cool, and definitively have all it’s pro and cons. At the moment I tend to stick with tldr as this projects seems the most active and already has a very nice set of cheatsheets. In addition it’s community-governed, which means contributions (pr’s) do not depend on a single person.

The only thing I miss is the possibility to have your own stuff. Here is where I use kb, cause it makes it very simple to use and really helps me to organize my knowledge from the console.