How to easily manage your Knowledge base with CNote: CLI Note Taking Tool

When I learn new things (research) or when I am coding I like to take copious amount of notes. Notes serve as a trail marker and also to jot down key points and summary of my explorations. Later on I search through my knowledge base and from the notes I can easily recollect the thread. Over the years I tried various tools like blogging ( ), EverNote, Google Keep and others. All I wanted was a simple tool which will not hamper my flow of work, taking minimal time to write and save.

Two major problems persisted:

  • Each of them was cumbersome and slow, halted the flow while I had to focus on it separately. Either they need browser or a heavy app to load. Browsers often have many tabs, so even if you keep it open you have to hunt for the tab first. Applications consume memory and CPU, little things which adds up when you many other Apps as well as browser tabs open. On the other hand I always have one or more console open and it is always easy to find and fast to use…
  • The second problem is that most of these tools require Internet connectivity. While in general that is perfectly fine, the connection can be spotty at times where I work and there is nothing more frustrating that waiting for connectivity to be restored before I can complete saving the note and getting back to what I was doing. Even if I go back to work there is always that nagging fear that it may not save properly and then I have to copy it back and save it to a file till the connection is restored and then try again. It happened to me number of times and I lost some important notes too.

How about a simple command line note taking tool?

I was looking for a simple tool which will allow me to write a line of text and fast. I don’t want to be bothered writing a structured note with a title and description and what not.

Not finding a good solution in the market I was forced to develop something myself. It started with few lines of bash shell script which I added to my .bashrc file of my desktop. It allowed me to easily save notes, search and delete them. All the data was saved in a readable text file. So if you made any mistake, you can always go back and edit it manually. I kept the commands simple and similar to what I already know — Linux shell commands. Adding a note is just n followed by your note:

n This is an example of a note.

Listing all your notes is nls:


Searching through your notes is nls followed by keyword(s):

nls cnote

This will find all notes which contain the word cnote.

Removing a note, you guessed it: nrm:

nrm flash

This will remove all notes containing the word flash.

It proved so useful that I added the same script to my Macbook and later on to the Raspberry Pi machines too as I was heavily experimenting with them. I timestamped the note so you have a context and also an order in the thoughts captured.

Adding it to various platforms brought the problem of merging them as I now had multiple .notes file, each with unique timestamped content. I didn’t want to lose the ordering created by timestamp and also wanted to easily merge them. So I changed the timestamp format to make it sortable with regular sort command.

The file are available on GitHub and can be automatically installed with:

wget --no-check-certificate -q -O-|bash -

How would like to see it improved? Drop me an email or connect with me on Twitter / Facebook.