Systemd-tmpfiles is a systemd utility that automatically manages the creation, deletion, and clean-up of volatile and temporary files and directories using conf files. Systemd-tmpfiles is critical to the functioning of your Linux system and supports many tasks that require the creation and deletion of ephemeral files.

I use systemd-tmpfiles to keep my systems clean and as hard nudge to steer me towards automation and use of git.

On my Linux servers I use systemd-tmpfiles to delete all files (excluding dot files) in user home directories when they reach 1 week in age. Having a hard deadline discourages me from making changes and leaving backup files and notes in my home directory and encourages me to push changes into git quickly.sed.

$ cat /var/home/adam/.local/share/user-tmpfiles.d/home.conf
  #Type	    Path			Mode	    User    	Group	Age
  d	/var/home/adam/		-	    -	    -	    1w
  x	/var/home/adam/.*	-	    -	    -	    -

On my Fedora Silverblue desktops I use systemd-tmpfiles to delete downloaded files when they reach 14 days in age. Again this discourages the practice of leaving files where they may be lost and reduces clutter in my home directory reducing friction.

My use of systemd-tmpfiles only scratches the surface of what is possible. The tmpfiles.d(5) manual page provides a great overview of all the supported file types and common use cases.

I expect that as I migrate my systems to bootc that I will be using tmpfiles.d(5) combined with cloud-init to assist with the dynamic creation and management of files in user home directories. This will be pivotal as I move towards disposable system