Turn Your Command Line Into A Fast, Simple Note-Taking Tool

If you love the command line and plain text, there's a good chance you're using Gina's todo.txt for your to-do list. If you're looking for similar command-line friendliness for your notes, CLI-lover Jack Mottram has you covered.

When it comes to jotting down notes, Notational Velocity for the Mac and its sister app for iOS, Simplenote, are hard to beat — both let you create, edit and search for notes with the minimum of friction so you can focus on writing. (Ed note: Windows apps like ResophNotes play nice with Simpenote, too.)

But what if you're at the command line or on a bare bones Linux box?

Here's a pair of simple shell functions that let you make and search for notes from the command line without expending too much effort.

First, create a directory in which to store your notes.

mkdir ~/notes

Then add the following to your .bashrc file (or .zshrc, if you're that way inclined).

n() { $EDITOR ~/notes/"$*".txt }

nls() { ls -c ~/notes/ | grep "$*" }

The first function will open a new file with your preferred editor, named whatever you type after the command n. The second will list, in reverse chronological order, files in your notes folder that match anything typed after the nls command.

So if you wanted to create a quick shopping list, you might type:

n shopping list

When you need to read the list or edit it, you can type n shopping list again to open it.

Or if you're in the habit of creating lots of shopping lists, you might type:

nls shopping

to show a list of all notes with the word 'shopping' in their filename, with the most recently-edited one at the top.

On their own, these functions will save you a fair few keystrokes, but they really shine when combined with note-taking applications that deal in plain text and file-synching utilities like Dropbox.

Symlink ~/notes to a directory inside your Dropbox folder, set Notational Velocity to store its notes there, and you've got yourself a nicely synchronised, cross-platform command line companion to NV.


Be the first to comment on this story!

Trending Stories Right Now