borg-placeholders(1)

✨ NAME ✨

borg-placeholders β€” the whole entire lore on placeholders, bestie πŸ’– (this is section 1 of the borg backup tool manual, if you were wondering).


🌸 DESCRIPTION 🌸

okay so listen. some of the stuff you type at borg can have lil magic words inside them, and borg will swap those magic words out for real values before it does anything. the spots that support this:

  • Repository (or Archive) URLs 🫢
  • --prefix
  • --glob-archives
  • --comment
  • --remote-path

here's every single placeholder, no skips, no cap:

  • {hostname} β€” the (short) hostname of the machine. the nickname version, not the whole legal name.
  • {fqdn} β€” the full name of the machine. the whole government name 😭
  • {reverse-fqdn} β€” the full name of the machine, but in reverse domain name notation. backwards but make it fashion πŸ’…
  • {now} β€” the current local date and time, and by default it's in ISO-8601 format. you can also supply your own format string (https://docs.python.org/3.10/library/datetime.html#strftime-and-strptime-behavior), e.g. {now:%Y-%m-%d_%H:%M:%S} β€” yes bestie you get to choose the fit ✨
  • {utcnow} β€” the current UTC date and time, by default in ISO-8601 format. you can also supply your own format string (https://docs.python.org/3.10/library/datetime.html#strftime-and-strptime-behavior), e.g. {utcnow:%Y-%m-%d_%H:%M:%S}
  • {user} β€” the user name (or the UID, if there's no name available) of whoever's running borg. main character energy πŸ‘‘
  • {pid} β€” the current process ID. it's giving "this specific run of borg and nobody else".
  • {borgversion} β€” the version of borg, e.g.: 1.0.8rc1
  • {borgmajor} β€” the version of borg, only the major version, e.g.: 1
  • {borgminor} β€” the version of borg, only major and minor version, e.g.: 1.0
  • {borgpatch} β€” the version of borg, only major, minor and patch version, e.g.: 1.0.8

πŸŽ€ escaping, aka "i literally just want curly braces" πŸŽ€

if you need literal curly braces, you double them up to escape them. double it and give it to the next person πŸ™ˆ

borg create /path/to/repo::{{literal_text}}

πŸ¦‹ EXAMPLES πŸ¦‹

here's how the girlies actually use it:

borg create /path/to/repo::{hostname}-{user}-{utcnow} ...
borg create /path/to/repo::{hostname}-{now:%Y-%m-%d_%H:%M:%S} ...
borg prune --glob-archives '{hostname}-*' ...

⚠️ Note ⚠️

systemd uses a difficult, non-standard syntax for command lines in unit files (refer to the systemd.unit(5) manual page). not me reading that and crying 😭
When invoking borg from unit files, pay particular attention to escaping, especially when using the now/utcnow placeholders, since systemd performs its own %-based variable replacement even in quoted text. To avoid interference from systemd, double all percent signs ({hostname}-{now:%Y-%m-%d_%H:%M:%S} becomes {hostname}-{now:%%Y-%%m-%%d_%%H:%%M:%%S}). fr fr, double those percent signs or systemd will eat your placeholders and you will be sad πŸ’€

πŸ’œ Author πŸ’œ

The Borg Collective. iconic. no further questions 🫢


okay that's the whole page, bestie β€” this was borg-placeholders(1) from the borg backup tool, version stamped 2026-07-18. go forth and placeholder responsibly βœ¨πŸŒˆπŸ’–

πŸ“¦ where this page comes from