mtree comes in the box, and it is used

For BSD users, the blurb for mtree would involve explaining the utility of having a data file and one process instead of a script of install and sha256 -c commands and lots of processes. The most obvious use of mtree is, after all, all of the specifications in /etc/mtree that are used to create, or re‐create, the operating system's main file hierarchy, and on some BSDs verify the file hashes of operating system files. It is also how ‘diskless’ /var is initialized (as a memory filesystem) at bootstrap on FreeBSD.

But for Linux‐based operating system users, the blurb for mtree is that it is how you do systemd-tmpfiles the BSD way, 20 years before systemd and (what was originally called) tempfiles were invented. As the manuals say, mtree was invented for 4.3BSD-Reno in 1990.

It is not based upon Microsoft's .INI file format from DOS+Windows. The mtree file format is a more conventional Unix scheme with whitespace‐delimited fields and backslash escaping. (Not any old backslash encoding, either. The file is in fact vis-encoded.)

You can tell mtree to simply check for files that do not match its specification, to (re‐)create files that are in its specification but do not exist, to delete files that exist that are not in its specification, or to even ensure that existing files have the permissions and whatnot that are listed in its specification.

Further reading

Always look in the manual of course:

© Copyright 2026 Jonathan de Boyne Pollard. "Moral" rights asserted.
Permission is hereby granted to copy and to distribute this web page in its original, unmodified form as long as its last modification datestamp is preserved.