1SYSTEMD-TMPFILES(8) systemd-tmpfiles SYSTEMD-TMPFILES(8)
2
3
4
6 systemd-tmpfiles, systemd-tmpfiles-setup.service, systemd-tmpfiles-
7 setup-dev.service, systemd-tmpfiles-clean.service, systemd-tmpfiles-
8 clean.timer - Creates, deletes and cleans up volatile and temporary
9 files and directories
10
12 systemd-tmpfiles [OPTIONS...] [CONFIGFILE...]
13
14 System units:
15
16 systemd-tmpfiles-setup.service
17 systemd-tmpfiles-setup-dev.service
18 systemd-tmpfiles-clean.service
19 systemd-tmpfiles-clean.timer
20
21 User units:
22
23 systemd-tmpfiles-setup.service
24 systemd-tmpfiles-clean.service
25 systemd-tmpfiles-clean.timer
26
28 systemd-tmpfiles creates, deletes, and cleans up volatile and temporary
29 files and directories, based on the configuration file format and
30 location specified in tmpfiles.d(5).
31
32 If invoked with no arguments, it applies all directives from all
33 configuration files. When invoked with --replace=PATH, arguments
34 specified on the command line are used instead of the configuration
35 file PATH. Otherwise, if one or more absolute filenames are passed on
36 the command line, only the directives in these files are applied. If
37 "-" is specified instead of a filename, directives are read from
38 standard input. If only the basename of a configuration file is
39 specified, all configuration directories as specified in tmpfiles.d(5)
40 are searched for a matching file and the file found that has the
41 highest priority is executed.
42
43 System services (systemd-tmpfiles-setup.service,
44 systemd-tmpfiles-setup-dev.service, systemd-tmpfiles-clean.service)
45 invoke systemd-tmpfiles to create system files and to perform system
46 wide cleanup. Those services read administrator-controlled
47 configuration files in tmpfiles.d/ directories. User services
48 (systemd-tmpfiles-setup.service, systemd-tmpfiles-clean.service) also
49 invoke systemd-tmpfiles, but it reads a separate set of files, which
50 includes user-controlled files under ~/.config/user-tmpfiles.d/ and
51 ~/.local/share/user-tmpfiles.d/, and administrator-controller files
52 under /usr/share/user-tmpfiles.d/. Users may use this to create and
53 clean up files under their control, but the system instance performs
54 global cleanup and is not influenced by user configuration. Note that
55 this means a time-based cleanup configured in the system instance, such
56 as the one typically configured for /tmp, will thus also affect files
57 created by the user instance if they are placed in /tmp, even if the
58 user instance's time-based cleanup is turned off.
59
61 The following options are understood:
62
63 --create
64 If this option is passed, all files and directories marked with f,
65 F, w, d, D, v, p, L, c, b, m in the configuration files are created
66 or written to. Files and directories marked with z, Z, t, T, a, and
67 A have their ownership, access mode and security labels set.
68
69 --clean
70 If this option is passed, all files and directories with an age
71 parameter configured will be cleaned up.
72
73 --remove
74 If this option is passed, the contents of directories marked with D
75 or R, and files or directories themselves marked with r or R are
76 removed.
77
78 --user
79 Execute "user" configuration, i.e. tmpfiles.d files in user
80 configuration directories.
81
82 --boot
83 Also execute lines with an exclamation mark.
84
85 --prefix=path
86 Only apply rules with paths that start with the specified prefix.
87 This option can be specified multiple times.
88
89 --exclude-prefix=path
90 Ignore rules with paths that start with the specified prefix. This
91 option can be specified multiple times.
92
93 --root=root
94 Takes a directory path as an argument. All paths will be prefixed
95 with the given alternate root path, including config search paths.
96
97 Note that this option does not alter how the users and groups
98 specified in the configuration files are resolved. With or without
99 this option, users and groups are always resolved according to the
100 host's user and group databases, any such databases stored under
101 the specified root directories are not consulted.
102
103 --replace=PATH
104 When this option is given, one ore more positional arguments must
105 be specified. All configuration files found in the directories
106 listed in tmpfiles.d(5) will be read, and the configuration given
107 on the command line will be handled instead of and with the same
108 priority as the configuration file PATH.
109
110 This option is intended to be used when package installation
111 scripts are running and files belonging to that package are not yet
112 available on disk, so their contents must be given on the command
113 line, but the admin configuration might already exist and should be
114 given higher priority.
115
116 --cat-config
117 Copy the contents of config files to standard output. Before each
118 file, the filename is printed as a comment.
119
120 --no-pager
121 Do not pipe output into a pager.
122
123 -h, --help
124 Print a short help text and exit.
125
126 --version
127 Print a short version string and exit.
128
129 It is possible to combine --create, --clean, and --remove in one
130 invocation (in which case removal and cleanup are executed before
131 creation of new files). For example, during boot the following command
132 line is executed to ensure that all temporary and volatile directories
133 are removed and created according to the configuration file:
134
135 systemd-tmpfiles --remove --create
136
138 systemd-tmpfiles tries to avoid changing the access and modification
139 times on the directories it accesses, which requires CAP_FOWNER
140 privileges. When running as non-root, directories which are checked for
141 files to clean up will have their access time bumped, which might
142 prevent their cleanup.
143
145 On success, 0 is returned. If the configuration was syntactically
146 invalid (syntax errors, missing arguments, ...), so some lines had to
147 be ignored, but no other errors occurred, 65 is returned (EX_DATAERR
148 from /usr/include/sysexits.h). If the configuration was syntactically
149 valid, but could not be executed (lack of permissions, creation of
150 files in missing directories, invalid contents when writing to /sys/
151 values, ...), 73 is returned (EX_CANTCREAT from
152 /usr/include/sysexits.h). Otherwise, 1 is returned (EXIT_FAILURE from
153 /usr/include/stdlib.h).
154
156 systemd(1), tmpfiles.d(5)
157
158
159
160systemd 243 SYSTEMD-TMPFILES(8)