Keeping a Plain Text Journal with jrnl

(Note: This article was first published, in a slightly different form, at Open Source Musings and appears here via a CC BY-SA 4.0 license.)

I’ve never been much good at keeping a journal. I’ve tried. Believe me, I’ve tried. It’s just never worked out. Chalk part of that up to laziness and part of that to the belief that little in my life is worth chronicling.

Every so often, though, I take another kick at the journalling can. This time around, I went back to a command line app that I tried and liked a few years ago. That app? jrnl. It’s a quick, easy, and minimalist way to keep a journal. Let’s take a look at it.

Getting Going

To install jrnl, you’ll need Python and a tool called pip installed on your computer. If they aren’t installed, do the deed using your Linux distribution’s package manager.

Open a terminal window and run the command pip install jrnl. It should only take a few seconds to install.

The first time you run, jrnl asks you where to store the file journal.txt (which stores your information). Out of the box, jrnl saves the file to the folder .local/share/jrnl/ in your /home directory.

Next, jrnl asks if you want to password protect the file journal.txt. If you do, enter a password. Don’t forget the password — you must enter it every time you write an entry in your journal.

Writing Journal Entries

You can do that in two ways. The first way is to type something like this at the command line:

jrnl My insightful journal entry

Of course, you’ll replace your text with what I wrote. I mean, what do I know about journalling? Press Enter to save the what you typed.

The other way is to type jrnl at the command line. This opens the file journal.txt in your default text editor. Type your entry, then save it.

Both methods have their advantages. Work straight from the command line enables to add a single-line entry quickly. By using a text editor, you can create an entry with multiple lines.

Adding Times and Dates to Your Journal Entries

When you create an entry, jrnl gives it a time and date — for example 2022-03-05 20:08. You can change that by adding your own timestamp.

To do that, type something like this:

jrnl timestamp: Did stuff

Don’t forget the colon after the timestamp.

The timestamp can be, for example, yesterday, Saturday at 8 am, a date, or a date and time.

If you use a timestamp that specifies a day, jrnl converts that to its date format. For example, entering last Monday adds the date 2022-02-24 to your entry.

Adding Favourites to Journal Entries

Maybe something big happened. Maybe something really good happened. Maybe you want to make sure it stands out in your journal. Do that by adding favourites to an entry. How? By adding an * — for example:

jrnl *Got a pay rise!

Make sure that there’s no space between the asterisk and the text.

Using Tags

If you use jrnl daily (or more than once a day), you’ll wind up with more than a few entries. That can make things interesting when you want to go back over some of them.

While jrnl has a decent search function (more on this in a few paragraphs), you can use tags to categorize your entries. Using tags, you can have journal entries for work, your personal life, to keep an exercise log, or whatever else you need to keep a journal for.

Add tags to a journal entry using the *@* sign, like this:

jrnl Did a non-stop hour of bodyweight @exercise. I'm tired!

Just make sure that the tags mean something to you and that they’re easy to remember.

Viewing Your Journal Entries

So you’ve been using jrnl for a while. And now you want to go back and view some of the entries in your journal. You can do that in several ways.

One way is to tell jrnl to show you the last number of entries by typing:

jrnl -n 8

That will display the last eight entries in your journal. Specify a larger or smaller number as needed.

You can also use dates and date ranges. Let’s say you want to view all the journal entries from January of this year to today. Do that by typing:

jrnl -from january

To view a range of dates, use the -from option with the -until option. Let’s say you want to view your journal entries from March 1 to March 15, 2022. To do that, type:

jrnl -from 2022-03-01 -until 2022-03-15

Viewing Favourite and Tagged Entries

View all of your favourite entries, type:

jrnl -starred

To view tagged entries, type:

jrnl @yourTag

You can include multiple tags if you need to. You can also specify a date or date range to view. You’ll need to add the and option to your search. For example, to view all entries tagged with @cycling from June 1 to June 15, type:

jrnl -from 2022-06-01 -until 2022-06-15 and @cycling

Is That All jrnl Can Do?

No. There’s a lot more this little utility can do. Read the documentation for more details about importing and exporting your journal and about some advanced options.

While I’m not sure that jrnl will get me back on the journalling horse, I’m more comfortable using it than any other journal app on my desktop, on the web, or on a mobile device.