Banner of Streamline Your Workflow: The Ultimate Tool for Command-Line Notes and Cheatsheets

Take Command of your Cheatsheets with this script

Category: Shell Scripting

Date: 4 months ago
Views: 990


In the world of shell scripting, simplicity and functionality often go hand in hand. The provided shell script is a testament to this philosophy. It serves as a versatile tool for both note-taking and managing cheatsheets, all within the familiar environment of the command line.

The Script:


if [[ $1 == "-e" ]] ; then
    vim  "${HOME}/.cheat/$2"
if [[ $1 == "-l" ]] ; then
    ls  "${HOME}/.cheat/"

less -p '^#.*' -R "${HOME}/.cheat/$1"


The script offers three main functionalities:

  1. Editing Notes/Cheatsheets: By providing the option -e followed by the name of the cheatsheet, the script opens the file in Vim for editing. For instance: ./ -e ffmpeg
    This command opens the ffmpeg file for editing within the Vim text editor.

  2. Listing Available Cheatsheets: The option -l lists all available cheatsheets stored in the .cheat directory. For example: ./ -l This command displays a list of all cheatsheets present in the .cheat folder.

  3. Viewing Cheatsheets: If neither -e nor -l options are provided, the script assumes the argument is the name of the cheatsheet to view. It then displays the contents of the cheatsheet using the less pager, highlighting lines starting with #, which often denote comments or headings.

Example usage of cheat
Example usage of cheat script

You can press v while in less command to enter editing mode with vim

Example usage of cheat
Editing the cheat file in vim

Usage Optimization:

To streamline usage even further, creating an alias for this script is a clever move. For instance, you could set up an alias like `cheat` that points to the script's location. This way, invoking the script becomes as simple as typing `cheat` followed by the desired command or option.

Moreover, leveraging the autocomplete feature of zsh can enhance efficiency even more. By configuring Zsh's autocomplete settings, you can enable suggestions for cheatsheet names stored within the `.cheat` directory. For instance, when typing `cheat` and pressing the `TAB` key, Zsh can present a dropdown menu of all available cheatsheets, allowing for quick selection without the need to recall filenames manually. This integration seamlessly integrates the script into your workflow, making accessing cheatsheets a breeze.

In practice, this autocomplete feature looks like this:

cheat autocomplete
cheat autocomplete


  1. Efficiency: With this script, accessing and managing cheatsheets becomes a seamless process directly from the command line, saving valuable time and effort.

  2. Organization: All cheatsheets are stored within the .cheat directory, keeping your notes neatly organized and easily accessible.

  3. Customization: The script is easily customizable to suit individual preferences or workflow requirements. Users can modify it to integrate additional features or tailor it to specific use cases.


In the realm of command-line productivity, having quick access to notes and cheatsheets can greatly enhance workflow efficiency. This shell script provides a simple yet effective solution, empowering users to manage their notes effortlessly and focus on the task at hand. With its versatility and ease of use, it stands as a valuable tool in the toolkit of any command-line aficionado.


Previous Article Next Article

0 Comments, latest

No comments.