**A Single Text File Is My Productivity Hack** October 22nd, 2024 By Alejandro Garcia We are living in the new dark ages. In the future, when our Cyborg descendants are trying to make sense of the early 2000s They will have a tough problem finding evidence because files get lost or even more frustrating. The tools that could read the file. Stop working. I'm terrified of storing my notes in file formats that might become obsolete in the next decade. These are my most private thoughts, a snapshot of my growth. Maybe they are worthless to the rest of the world, but they are valuable to me. That is why I type my notes in plain text. However, having many small files creates challenges with organization, searchability and formating. So in 2020, when I read this post: [My productivity app is a never-ending .txt file](https://jeffhuang.com/productivity_text_file/) I was inspired to try it myself. Being an Emacs and Bash user immediately resonated with me. So the idea is that you write your notes in a long text file, and then you need to search for something it's as simple as doing a `grep` of your text file. What I like about the single-text file method is that it doesn't require anything. Just open a text file. Write the date in one line and write your note next to it, and you're done. However, over the years, I have settled on a couple of "hacks" that make this even better. My tricks are: - Use jrnl - Create a shortcut on your keyboard to add notes. - Use a variant of the Getting Things Done organization method. Let's see these tricks. # Use `jrnl` [Jrnl](https://jrnl.sh/en/stable/) is a command-line app that formats and searches your text file. For example, if I have an idea that I want to share with @Agus (he is another member of our cooperative). I would write in the command line: ``` bash jrnl Ask @Agus How can I recycle pet plastic for my @3d-printer ``` This instruction will append the following entry in my ~/jrnl.txt file. ``` bash $ tail -1 ~/notes/jrnl.txt [2024-10-22 01:20:15 PM] Ask @Agus How can I recycle pet plastic for my @3d-printer ``` As you can see, the current date and time have been prepended to our note. Now, let's suppose: I'm meeting @Agus in person, and I want to remember everything I would ask him. The command is: ``` bash $ jrnl @Agus ┏━━━━━━━━━━━━━━━━━━━━┓ ┃ 16 entries found ┃ ┗━━━━━━━━━━━━━━━━━━━━┛ 2023-09-10 07:07:07 AM @agus about the naked objects pattern, maybe search for a video example and develop it in Eiffel . . . 2024-10-22 01:20:15 PM Ask @Agus How can I recycle pet plastic for my @3d-printer ``` Observe that the search is case insensitive, so it will return me entries with @Agus and @agus equally. We can search by either having one OR two tags: ``` bash $ jrnl @agus @nohemi ┏━━━━━━━━━━━━━━━━━━━━┓ ┃ 18 entries found ┃ ┗━━━━━━━━━━━━━━━━━━━━┛ ``` Also, we can search by entries that have both tags (and). ``` bash $ jrnl @agus -and @3d-printer ┏━━━━━━━━━━━━━━━━━┓ ┃ 1 entry found ┃ ┗━━━━━━━━━━━━━━━━━┛ 2024-10-22 01:20:15 PM Ask @Agus How can I recycle pet plastic for my @3d-printer ``` We can also search by date. ``` bash $ jrnl -on 2024-10-22 ┏━━━━━━━━━━━━━━━━━┓ ┃ 1 entry found ┃ ┗━━━━━━━━━━━━━━━━━┛ 2024-10-22 01:20:15 PM Ask @Agus How can I recycle pet plastic for my @3d-printer ``` We can see what tags we have: ``` bash $ jrnl --tags ┏━━━━━━━━━━━━━━━━━━━━━┓ ┃ 526 entries found ┃ ┗━━━━━━━━━━━━━━━━━━━━━┛ @racket-con : 31 @ideas : 25 @til : 23 ... ``` You can run all those commands and get even Json, and then use other tools like `jsonata` or `jq` to do some further processing. ``` bash $ jrnl @agus -and @3d-printer --format json ┏━━━━━━━━━━━━━━━━━┓ ┃ 1 entry found ┃ ┗━━━━━━━━━━━━━━━━━┛ { "tags": { "@3d-printer": 1, "@agus": 1 }, "entries": [ { "title": "Ask @Agus How can I recycle pet plastic for my @3d-printer", "body": "", "date": "2024-10-22", "time": "13:20", "tags": [ "@3d-printer", "@agus" ], "starred": false } ] } ``` All in all, `jrnl` has been the most user-friendly way to keep a long text file as my notes document. # Create a keyboard shortcut My next hack is to create a shortcut that opens your text editor with the notes file already opened with a text line. You can ask ChatGPT how to do this for your operating system. ## Create a script to open the text file In my case, using the Ubuntu operating system with the `gedit` text editor is as simple as: creating a script `nano ~/append_datetime_to_jrnl.sh` ``` bash #!/bin/bash # Script to append the current date and time to jrnl.txt and open it in gedit current_date_time=$(date "+%Y-%m-%d %H:%M:%S") echo "$current_date_time" >> ~/notes/jrnl.txt gedit ~/notes/jrnl.txt ``` Then make the script executable: `chmod +x ~/append_datetime_to_jrnl.sh` ## Assigen a the script to a keyboard Shortcut Go to Settings -> Keyboard -> Custom Shortcuts. Click Add Shortcut. Set the Name to something like Append Date/Time to Journal. In the Command field, enter the path to your script: bash Copy code /home/your-username/append_datetime_to_jrnl.sh Replace your-username with your actual username. Set the desired keyboard shortcut by pressing the keys you want to use (e.g., Ctrl + Alt + J). Click Add. # Using the Getting Things Done method Finally, the GTD method, popularized by David Allen, has many techniques for organizing oneself. However, the core of the method is to have several lists of activities depending on the context. for example an @home : is to write things that you intend to do when you are at your home @agus : is to write lists of things you want to discuss when seeing Agus. @email : to write emails that you would like to write. @some-day : is to write projects or dreams you would like to tackle someday. As we have seen with `jrnl`, it is straightforward to implement all of these lists as a single text file with tags. # Bonus tip: I Love Me list My friend and supervisor, Paul M. Jones, taught me to keep the @I_love_me list. The idea is to write down your accomplishments, personal and professional. This list is essential. Sometimes, we are sad and need a little shot of our "self-esteem." It's just a matter of writing `jrnl @I_love_me` and reading about the things we have done in the past to find perspective. The list also has a professional value. When is time for your yearly review at work. And you need to remember your accomplishments is as simple as: ``` bash jrnl @I_love_me -and @work -from 2024-01-01 -to 2024-12-31 ``` # Conclusion A simple text file, with `jrnl` and some habits inspired by the GTD, has been my best note-taking application. This method will continue to work in the next 40 years. Or when it's time to merge our conciousness with the great computer in the sky, I'll have my notes ready ;-)