A girl taking notes.

Managing Notes on Linux


Here’s how I write and manage my notes and sync them between different devices on Linux without depending on services like Notion.

The setup is simple:

Note: My system uses systemd (which is usually the default on most systems). If you’re using something else you’ll need to adapt the relevant parts.

1. Obsidian

Obsidian is a Markdown-based note-taking app with a strong community and a big plugin ecosystem. It’s free (not open source), and all your notes are plain .md files stored locally — no forced cloud syncs.

1.1. Install Obsidian (Arch Linux)

Terminal
sudo pacman -S obsidian

If you’re new to Obsidian, the help docs are pretty useful to get started.

2. Syncthing

To keep notes synced between devices (like your phone and laptop), I use Syncthing. It works over LAN, and you control everything.

2.1. Install Syncthing

Terminal
sudo pacman -S syncthing

2.2. Enable and Start the Service

Terminal
sudo systemctl enable --now syncthing@<user>.service

Replace <user> with your actual username.

Then open http://127.0.0.1:8384 in your browser — this is the Syncthing web UI.

2.3. Mobile Syncing

Install the Syncthing app on Android or iOS to sync your notes to your phone.

2.4. Firewall (if devices can’t connect)

If you’re using UFW, run:

Terminal
sudo ufw allow syncthing

If you’re not using UFW, a quick Google search will help you figure it out 🤗.

3. Git & GitHub Backup

Syncthing handles syncing, but it doesn’t track changes. That’s where Git comes in. With Git, you get version history and we will use GitHub to host the git repo to be able to access it from anywhere.

3.1. Install Git

Terminal
sudo pacman -S git

3.2. Create a GitHub Repo

If you don’t already have a GitHub account, now’s the time. Create a private repo for your notes and clone it locally.

  • Then create a new folder inside the GitHub repo we just cloned.
  • In Obsidian, set that folder (not the root of the repo itself) as your vault.

4. Automating Git Commits

You could manually git commit and git push your changes every day… but that can be labour intensive. Let’s automate it.

4.1. Write a Commit Script

Create this script at ~/.local/bin/git_auto_commit.sh:

#!/bin/bash
export HOME=/home/<user>
git config --global --add safe.directory /home/<user>/<git-repo>
cd /home/<user>/<git-repo> || exit
git add .
git commit -m "Auto-commit $(date +'%Y-%m-%d %H:%M:%S')"
git push origin main

Make sure to replace:

  • <user> with your actual Linux username
  • <git-repo> with the folder name of your GitHub repo

Make it executable:

Terminal
chmod +x ~/.local/bin/git_auto_commit.sh

4.2. Add .local/bin to PATH (if needed)

Check if it’s already in your $PATH:

Terminal
echo "$PATH" | grep -q "$HOME/.local/bin" && echo "You're good!" || echo "Need to add it."

If not, add it to your shell config:

4.2.1. For Bash:

Terminal
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc

4.2.2. For Zsh:

Terminal
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc

5. systemd Automation

We’ll create a systemd timer that runs the script every 2 hours.

5.1. Create the Service

Create this file:
/etc/systemd/system/git_auto_commit.service

e.g. with neovim sudo nvim /etc/systemd/system/git_auto_commit.service

[Unit]
Description=Git Auto Commit Service
[Service]
Type=oneshot
User=<user>
ExecStart=/home/<user>/.local/bin/git_auto_commit.sh

5.2. Create the Timer

Create this file:
/etc/systemd/system/git_auto_commit.timer

e.g. with neovim sudo nvim /etc/systemd/system/git_auto_commit.timer

[Unit]
Description=Run git_auto_commit.service every 2 hours
[Timer]
OnBootSec=10min
OnUnitActiveSec=2h
[Install]
WantedBy=timers.target

5.3. Enable the Timer

Reload systemd and start the timer:

Terminal
sudo systemctl daemon-reload
sudo systemctl enable --now git_auto_commit.timer

You can check the timer’s status with:

Terminal
systemctl status git_auto_commit.timer

And see logs with:

Terminal
journalctl -u git_auto_commit.service

To test it manually:

Terminal
sudo systemctl start git_auto_commit.service

6. Final Thoughts

That’s it! With this setup you get:

  • Local-first note-taking
  • Syncing across all your devices
  • Automatic version control

With this setup no one will be able to hold your notes hostage. If you have ideas to improve this setup, or if something doesn’t work as expected, feel free to reach out.

#notes#linux