Daily Notes Setup (Markdown, Linux)
Table of Contents
Introduction
Do you need a simple way to create and manage daily notes?
With this setup, all I need to do to get to my daily note is to type
nv
in the terminal.
I got accustomed to using daily notes when I started using Obsidian, more specifically the Daily Notes plugin. It allows you to create a new note for each day, which I found very useful for both professional and personal use.
Now, several years later, I’m sticking to a more minimal terminal setup, but still using the Markdown format, and working with it via nvim, tmux and lf. These tools do not matter much though, as the main point here is file management and saving time on creating daily notes.
The script below will work regardless of the editor you use, as long as it supports Markdown. I’ll use nvim
in the examples.
Script
Here’s a simple script that will create (and optionally open) a daily note of the format YY-MM-DD.md
in the ~/Daily/
directory. If the note already exists, it will just open it, and if the directory does not exist, it will create it.
#!/bin/bash
# Initialize variable for opening in Neovim
OPEN_IN_NEOVIM=false
# Parse command line options
while getopts "o" opt; do
case $opt in
o)
OPEN_IN_NEOVIM=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
# Get current date in YYYY-MM-DD format
DATE=$(date +%Y-%m-%d)
# Define directory and file paths
NOTES_DIR="$HOME/Daily"
FILE_PATH="$NOTES_DIR/$DATE.md"
# Create daily directory if it doesn't exist
mkdir -p "$NOTES_DIR"
# Create note file if it doesn't exist
if [ ! -f "$FILE_PATH" ]; then
echo "# Daily Note for $DATE" > "$FILE_PATH"
echo "" >> "$FILE_PATH"
echo "## Tasks" >> "$FILE_PATH"
echo "" >> "$FILE_PATH"
echo "## Notes" >> "$FILE_PATH"
echo "Created note: $FILE_PATH"
else
echo "Note already exists: $FILE_PATH"
fi
# Open in Neovim if -o flag is provided
if [ "$OPEN_IN_NEOVIM" = true ]; then
nvim "$FILE_PATH"
fi
Save this script, for example as ~/.local/scripts/daily_note.sh
, and make it executable:
chmod +x ~/.local/scripts/daily_note.sh
Then, assign a keyboard shortcut to run the script. I use an alias in my ~/.bashrc
or ~/.zshrc
file:
alias n='$HOME/.local/scripts/daily.sh'
alias nv='$HOME/.local/scripts/daily.sh -o'
Apply the changes to your shell configuration:
source ~/.bashrc
What this does is:
n
will create a new daily note for today in the~/Daily/
directory, or skip if it already exists.nv
will do the same, but also open the note innvim
. If it already exists, it will just open it.
Typically I will do this in a tmux session that I run in the home directory, so I can easily access the notes and other files. tmux session management will be covered elsewhere, but the setup is based on tmux-sessionizer.
File naming
The naming convention that the script uses is YY-MM-DD.md
, which is a common format for daily notes. It allows to easily sort and find notes by date.
Template structure
The template is quite minimal, and you can customize it to your liking. The default template includes just the “Tasks” and “Notes” sections, but it is easily customizable.
Conclusion
Hopefully, this setup is useful and can save you some time on creating and managing daily notes, like it does for me every day.
Feel free to leave a comment below, and have a good day!
Andrew
Recent Posts

Training while on the road with minimal equipment, such as a loadable Indian Club

Andrew O

How (and why) to future-proof your digital training logs with Markdown plain-text format

Andrew O

An easy way to create a screen capture on Wayland(Hyprland) to WebP or gif format

Andrew O
Leave a comment
Need help? Get 1:1 live session on a trusted platform
Contact me on Codementor to schedule a 1:1 live session to help with your project or to learn something new.