The Linux Rain Linux General/Gaming News, Reviews and Tutorials

Memo - Note Taking, Unix-style

By Andrew Powell, published 25/10/2014 in Reviews


We all take notes in various ways. Whether it's old fashioned sticky notes littering the front of your PC monitor, an app on your smartphone or simply using your brain to take a 'mental note' (if your memory is that good!), it's a useful activity. How about note taking on the command-line? And in a really Unix-y, flexible way? Memo might be for you.

Memo is a note taking application developed by Niko Rosvall for GNU/Linux, although it should be portable for most POSIX-compatible operating systems. As mentioned above, Memo is in particular a Unix-style piece of software. The significance of this, besides the implication of being command-line based, is that the program integrates well with standard Unix tools. This means the uses and ways you can use Memo is only limited by your imagination (and command-line skills/knowledge of course).

Using Memo

Memo is a very simple, command-line driven application. Don't let that fool you into thinking it's limited though. Well, by itself, it may indeed seem limited. But Memo is a Unix-style program and therefore adheres to the Unix philosophy of "do one thing, and do it well". As stated in the preface of the book, The UNIX Programming Environment: "Many Unix programs do quite trivial things in isolation, but, combined with other programs, become general and useful tools".

The same can be described of Memo. It's basic and singular function is to, well, take notes. You can add, edit, delete and search through notes.

Adding a note is as simple as typing:

memo -a "This is my totally awesome note about stuff"

You could then search for this specific note by typing:

memo -f stuff

To delete a note, simply use the -d flag with the id of the note you want to delete:

memo -d 1

If you want to replace (edit) a specific note, then simply chain the delete command with the add command as below. Memo is smart enough to handle the rest:

memo -d 1 -a "My edited note.."

In the image above, you may notice I used two different commands (memo -s and memo -l[number]) to get a result of existing notes. memo -s simply displays all notes in Memo, while, for example memo -l5 will display the last 5 notes. You can choose any number there that you wish.

You can even pipe in text from stdin!

echo "My other awesome note" | memo

Of course, memo -h will display all the options available to you or man memo will get you the manual page.

Getting Memo

You will need to build Memo from source. Wait, don't shut down this article and run for the hills just yet!

Memo is a very simple application written in C99 and literally builds in no time. Download the archive from the Memo homepage and extract the compressed folder to a location of your choosing.

Fire up a terminal and cd to the folder you just extracted.

Then simply type:

make

and press enter. Bam, you now have a compiled Memo binary.

You can simply run the binary from the folder by typing ./memo. If you wish to install it system-wide, then the good old make install (you may need to use sudo as well) commands will do the trick.

Other neat tricks

I ran through some of the basic typical functions to use Memo, but there are some other tricks and interesting ways you can make use of a Unix-style program such as Memo. I'm no command-line expert, but even I can think of a few.

For one, there is integration with Conky, the famous lightweight and highly configurable system monitor. See below for a basic idea, which I whipped up in a couple of minutes.

If you're a Conky user, the following lines of code easily add this functionality to Conky (by adding the lines to your .conkyrc file):

$hr 
${color grey}Notes: 
${color lightgrey}${exec memo -l10 | cut -f3}  

The memo -l10 | cut -f3 portion of that last line is what does the magic of executing the Memo output. As Memo outputs the data in simple, easy to handle columns, the cut command can be used to display simply the note text (using the "-f3" flag) instead of the note id and the note date. Of course, you can display it however you want. The "-l10" portion of the memo command, of course, is to display the last 10 note entries. You can choose whatever you like there as well.

The other thing you can do, which is actually an inbuilt functionality of Memo, is export your notes to an HTML file, like so:

memo -e [filename].html

How does that relate to the command-line and Unix programs, etc? Well, I imagine one could use that functionality to periodically generate (update) an HTML file, perhaps via cron, that could then be used (for example) as your web browser homepage. Which might be a handy way to remind yourself of your latest notes if you use your web browser a lot.

Speaking of cron, how about reminders via email? Well, the developer himself shares an example of a script (to be run via cron) that can accomplish this on the Memo Usage page.

#!/bin/bash

filename="$HOME/.memo"
today=`date +%Y-%m-%d`

if [ -f $filename ]; then
    while read -r line
    do
    date=`echo "$line" | cut -f3`

    if [ "$today" == "$date" ]; then
        echo "$line" | cut -f4 | mutt -s "Reminder from Memo" foo@example.com
    fi

    done < "$filename"
fi

It's intended for use with the Mutt mail program, but I imagine you could easily adapt it for any mail program of your choosing.

Conclusion

Memo is a wonderfully simple and easy to use (talking from the point of view of someone comfortable with the CLI, of course) program that just does what it says on the tin. It receives your input and stores them as notes and outputs the data in a simple column structured format that makes text manipulation using standard Unix tools very easy.

Of course, if you're after something a bit more full featured "out of the box" or something with a graphical interface, Memo won't be for you. But there are plenty of alternatives, no doubt, for those that want those kinds of note taking software.

For someone who loves doing things the Unix-y way or just loves to take advantage of lightweight programs and scripts, you should give Memo a go.

UPDATE: When composing this article, Memo was at version 0.9. Just after the upload of this article, I noticed Memo 1.0 has been released! It features a handy new feature to list notes as "done" or "undone" as well as stability/memory fixes.

Memo Homepage



About the author

Andrew Powell is the editor and owner of The Linux Rain who loves all things Linux, gaming and everything in between.

Tags: reviews memo note-taking journal commandline unix
blog comments powered by Disqus