1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2014 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="file-hierarchy">
27 <title>file-hierarchy</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>file-hierarchy</refentrytitle>
42 <manvolnum>7</manvolnum>
46 <refname>file-hierarchy</refname>
47 <refpurpose>File system hierarchy overview</refpurpose>
51 <title>Description</title>
53 <para>Operating systems using the
54 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
55 system and service manager are organized based on a file system
56 hierarchy inspired by UNIX, more specifically the hierarchy
57 described in the <ulink
58 url="http://refspecs.linuxfoundation.org/FHS_2.3/fhs-2.3.html">File
59 System Hierarchy</ulink> specification and
60 <citerefentry project='man-pages'><refentrytitle>hier</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
61 This manual page describes a more minimal, modernized subset of
62 these specifications that defines more strictly the suggestions
63 and restrictions systemd makes on the file system
66 <para>Many of the paths described here are queriable
68 <citerefentry><refentrytitle>systemd-path</refentrytitle><manvolnum>1</manvolnum></citerefentry>
73 <title>General Structure</title>
77 <term><filename>/</filename></term>
78 <listitem><para>The file system root. Usually writable, but
79 this is not required. Possibly a temporary file system
80 (<literal>tmpfs</literal>). Not shared with other hosts
81 (unless read-only). </para></listitem>
85 <term><filename>/boot</filename></term>
86 <listitem><para>The boot partition used for bringing up the
87 system. On EFI systems this is possibly the EFI System
89 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
90 This directory is usually strictly local to the host, and
91 should be considered read-only, except when a new kernel or
92 boot loader is installed. This directory only exists on
93 systems that run on physical or emulated hardware that
94 requires boot loaders.</para></listitem>
98 <term><filename>/etc</filename></term>
99 <listitem><para>System-specific configuration. This directory
100 may or may not be read-only. Frequently, this directory is
101 pre-populated with vendor-supplied configuration files, but
102 applications should not make assumptions about this directory
103 being fully populated or populated at all, and should fall
104 back to defaults if configuration is
105 missing.</para></listitem>
109 <term><filename>/home</filename></term>
110 <listitem><para>The location for normal user's home
111 directories. Possibly shared with other systems, and never
112 read-only. This directory should only be used for normal
113 users, never for system users. This directory and possibly the
114 directories contained within it might only become available or
115 writable in late boot or even only after user authentication.
116 This directory might be placed on limited-functionality
117 network file systems, hence applications should not assume the
118 full set of file API is available on this directory.
119 Applications should generally not reference this directory
120 directly, but via the per-user <varname>$HOME</varname>
121 environment variable, or via the home directory field of the
122 user database.</para></listitem>
126 <term><filename>/root</filename></term>
127 <listitem><para>The home directory of the root user. The root
128 user's home directory is located outside of
129 <filename>/home</filename> in order to make sure the root user
130 may log in even without <filename>/home</filename> being
131 available and mounted.</para></listitem>
135 <term><filename>/srv</filename></term>
136 <listitem><para>The place to store general server payload,
137 managed by the administrator. No restrictions are made how
138 this directory is organized internally. Generally writable,
139 and possibly shared among systems. This directory might become
140 available or writable only very late during
141 boot.</para></listitem>
145 <term><filename>/tmp</filename></term>
146 <listitem><para>The place for small temporary files. This
147 directory is usually mounted as a <literal>tmpfs</literal>
148 instance, and should hence not be used for larger files. (Use
149 <filename>/var/tmp</filename> for larger files.) Since the
150 directory is accessible to other users of the system it is
151 essential that this directory is only written to with the
152 <citerefentry project='man-pages'><refentrytitle>mkstemp</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
153 <citerefentry project='man-pages'><refentrytitle>mkdtemp</refentrytitle><manvolnum>3</manvolnum></citerefentry>
154 and related calls. This directory is usually flushed at
155 boot-up. Also, files that are not accessed within a certain
156 time are usually automatically deleted. If applications find
157 the environment variable <varname>$TMPDIR</varname> set they
158 should prefer using the directory specified in it over
159 directly referencing <filename>/tmp</filename> (see
160 <citerefentry project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>
162 <ulink url="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">IEEE
163 Std 1003.1</ulink> for details).</para></listitem>
170 <title>Runtime Data</title>
174 <term><filename>/run</filename></term>
175 <listitem><para>A <literal>tmpfs</literal> file system for
176 system packages to place runtime data in. This directory is
177 flushed on boot, and generally writable for privileged
178 programs only. Always writable.</para></listitem>
182 <term><filename>/run/log</filename></term>
183 <listitem><para>Runtime system logs. System components may
184 place private logs in this directory. Always writable, even
185 when <filename>/var/log</filename> might not be accessible
186 yet.</para></listitem>
190 <term><filename>/run/user</filename></term>
191 <listitem><para>Contains per-user runtime directories, each
192 usually individually mounted <literal>tmpfs</literal>
193 instances. Always writable, flushed at each reboot and when
194 the user logs out. User code should not reference this
195 directory directly, but via the
196 <varname>$XDG_RUNTIME_DIR</varname> environment variable, as
197 documented in the <ulink
198 url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG
199 Base Directory Specification</ulink>.</para></listitem>
205 <title>Vendor-supplied Operating System Resources</title>
210 <term><filename>/usr</filename></term>
211 <listitem><para>Vendor-supplied operating system resources.
212 Usually read-only, but this is not required. Possibly shared
213 between multiple hosts. This directory should not be modified
214 by the administrator, except when installing or removing
215 vendor-supplied packages.</para></listitem>
219 <term><filename>/usr/bin</filename></term>
220 <listitem><para>Binaries and executables for user commands,
221 that shall appear in the <varname>$PATH</varname> search path.
222 It is recommended not to place binaries in this directory that
223 are not useful for invocation from a shell (such as daemon
224 binaries); these should be placed in a subdirectory of
225 <filename>/usr/lib</filename> instead.</para></listitem>
229 <term><filename>/usr/include</filename></term>
230 <listitem><para>C and C++ API header files of system
231 libraries.</para></listitem>
235 <term><filename>/usr/lib</filename></term>
236 <listitem><para>Static, private vendor data that is compatible
237 with all architectures (though not necessarily
238 architecture-independent). Note that this includes internal
239 executables or other binaries that are not regularly invoked
240 from a shell. Such binaries may be for any architecture
241 supported by the system. Do not place public libraries in this
242 directory, use <varname>$libdir</varname> (see below),
243 instead.</para></listitem>
247 <term><filename>/usr/lib/<replaceable>arch-id</replaceable></filename></term>
248 <listitem><para>Location for placing dynamic libraries, also
249 called <varname>$libdir</varname>. The architecture identifier
250 to use is defined on <ulink
251 url="https://wiki.debian.org/Multiarch/Tuples">Multiarch
252 Architecture Specifiers (Tuples)</ulink> list. Legacy
253 locations of <varname>$libdir</varname> are
254 <filename>/usr/lib</filename>,
255 <filename>/usr/lib64</filename>. This directory should not be
256 used for package-specific data, unless this data is
257 architecture-dependent, too. To query
258 <varname>$libdir</varname> for the primary architecture of the
260 <programlisting># systemd-path system-library-arch</programlisting></para></listitem>
265 <term><filename>/usr/share</filename></term>
266 <listitem><para>Resources shared between multiple packages,
267 such as documentation, man pages, time zone information, fonts
268 and other resources. Usually, the precise location and format
269 of files stored below this directory is subject to
270 specifications that ensure interoperability.</para></listitem>
274 <term><filename>/usr/share/doc</filename></term>
275 <listitem><para>Documentation for the operating system or
276 system packages.</para></listitem>
280 <term><filename>/usr/share/factory/etc</filename></term>
281 <listitem><para>Repository for vendor-supplied default
282 configuration files. This directory should be populated with
283 pristine vendor versions of all configuration files that may
284 be placed in <filename>/etc</filename>. This is useful to
285 compare the local configuration of a system with vendor
286 defaults and to populate the local configuration with
287 defaults.</para></listitem>
291 <term><filename>/usr/share/factory/var</filename></term>
293 <listitem><para>Similar to
294 <filename>/usr/share/factory/etc</filename> but for vendor
295 versions of files in the variable, persistent data directory
296 <filename>/var</filename>.</para></listitem>
303 <title>Persistent Variable System Data</title>
307 <term><filename>/var</filename></term>
308 <listitem><para>Persistent, variable system data. Must be
309 writable. This directory might be pre-populated with
310 vendor-supplied data, but applications should be able to
311 reconstruct necessary files and directories in this
312 subhierarchy should they be missing, as the system might start
313 up without this directory being populated. Persistency is
314 recommended, but optional, to support ephemeral systems. This
315 directory might become available or writable only very late
316 during boot. Components that are required to operate during
317 early boot hence shall not unconditionally rely on this
318 directory.</para></listitem>
322 <term><filename>/var/cache</filename></term>
323 <listitem><para>Persistent system cache data. System
324 components may place non-essential data in this directory.
325 Flushing this directory should have no effect on operation of
326 programs, except for increased runtimes necessary to rebuild
327 these caches.</para></listitem>
331 <term><filename>/var/lib</filename></term>
332 <listitem><para>Persistent system data. System components may
333 place private data in this directory.</para></listitem>
337 <term><filename>/var/log</filename></term>
338 <listitem><para>Persistent system logs. System components may
339 place private logs in this directory, though it is recommended
340 to do most logging via the
341 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
343 <citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry>
344 calls.</para></listitem>
348 <term><filename>/var/spool</filename></term>
349 <listitem><para>Persistent system spool data, such as printer
350 or mail queues.</para></listitem>
354 <term><filename>/var/tmp</filename></term>
355 <listitem><para>The place for larger and persistent temporary
356 files. In contrast to <filename>/tmp</filename> this directory
357 is usually mounted from a persistent physical file system and
358 can thus accept larger files. (Use <filename>/tmp</filename>
359 for smaller files.) This directory is generally not flushed at
360 boot-up, but time-based cleanup of files that have not been
361 accessed for a certain time is applied. The same security
362 restrictions as with <filename>/tmp</filename> apply, and
364 <citerefentry project='man-pages'><refentrytitle>mkstemp</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
365 <citerefentry project='man-pages'><refentrytitle>mkdtemp</refentrytitle><manvolnum>3</manvolnum></citerefentry>
366 or similar calls should be used to make use of this directory.
367 If applications find the environment variable
368 <varname>$TMPDIR</varname> set they should prefer using the
369 directory specified in it over directly referencing
370 <filename>/var/tmp</filename> (see
371 <citerefentry project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>
372 for details). </para></listitem>
379 <title>Virtual Kernel and API File Systems</title>
383 <term><filename>/dev</filename></term>
384 <listitem><para>The root directory for device nodes. Usually
385 this directory is mounted as a <literal>devtmpfs</literal>
386 instance, but might be of a different type in
387 sandboxed/containerized setups. This directory is managed
388 jointly by the kernel and
389 <citerefentry><refentrytitle>systemd-udevd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
390 and should not be written to by other components. A number of
391 special purpose virtual file systems might be mounted below
392 this directory.</para></listitem>
396 <term><filename>/dev/shm</filename></term>
397 <listitem><para>Place for POSIX shared memory segments, as
399 <citerefentry project='die-net'><refentrytitle>shm_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
400 This directory is flushed on boot, and is a
401 <literal>tmpfs</literal> file system. Since all users have
402 write access to this directory, special care should be taken
403 to avoid name clashes and vulnerabilities. For normal users,
404 shared memory segments in this directory are usually deleted
405 when the user logs out. Usually it is a better idea to use
406 memory mapped files in <filename>/run</filename> (for system
407 programs) or <varname>$XDG_RUNTIME_DIR</varname> (for user
408 programs) instead of POSIX shared memory segments, since those
409 directories are not world-writable and hence not vulnerable to
410 security-sensitive name clashes.</para></listitem>
414 <term><filename>/proc</filename></term>
415 <listitem><para>A virtual kernel file system exposing the
416 process list and other functionality. This file system is
417 mostly an API to interface with the kernel and not a place
418 where normal files may be stored. For details, see
419 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
420 A number of special purpose virtual file systems might be
421 mounted below this directory.</para></listitem>
425 <term><filename>/proc/sys</filename></term>
426 <listitem><para>A hierarchy below <filename>/proc</filename>
427 that exposes a number of kernel tunables. The primary way to
428 configure the settings in this API file tree is via
429 <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
430 files. In sandboxed/containerized setups this directory is
431 generally mounted read-only.</para></listitem>
435 <term><filename>/sys</filename></term>
436 <listitem><para>A virtual kernel file system exposing
437 discovered devices and other functionality. This file system
438 is mostly an API to interface with the kernel and not a place
439 where normal files may be stored. In sandboxed/containerized
440 setups this directory is generally mounted read-only. A number
441 of special purpose virtual file systems might be mounted below
442 this directory.</para></listitem>
449 <title>Compatibility Symlinks</title>
453 <term><filename>/bin</filename></term>
454 <term><filename>/sbin</filename></term>
455 <term><filename>/usr/sbin</filename></term>
457 <listitem><para>These compatibility symlinks point to
458 <filename>/usr/bin</filename>, ensuring that scripts and
459 binaries referencing these legacy paths correctly find their
460 binaries.</para></listitem>
464 <term><filename>/lib</filename></term>
466 <listitem><para>This compatibility symlink points to
467 <filename>/usr/lib</filename>, ensuring that programs
468 referencing this legacy path correctly find their
469 resources.</para></listitem>
473 <term><filename>/lib64</filename></term>
475 <listitem><para>On some architecture ABIs this compatibility
476 symlink points to <varname>$libdir</varname>, ensuring that
477 binaries referencing this legacy path correctly find their
478 dynamic loader. This symlink only exists on architectures
479 whose ABI places the dynamic loader in this
480 path.</para></listitem>
484 <term><filename>/var/run</filename></term>
486 <listitem><para>This compatibility symlink points to
487 <filename>/run</filename>, ensuring that programs referencing
488 this legacy path correctly find their runtime
489 data.</para></listitem>
496 <title>Home Directory</title>
498 <para>User applications may want to place files and directories in
499 the user's home directory. They should follow the following basic
500 structure. Note that some of these directories are also
501 standardized (though more weakly) by the <ulink
502 url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG
503 Base Directory Specification</ulink>. Additional locations for
504 high-level user resources are defined by <ulink
505 url="http://www.freedesktop.org/wiki/Software/xdg-user-dirs/">xdg-user-dirs</ulink>.</para>
509 <term><filename>~/.cache</filename></term>
511 <listitem><para>Persistent user cache data. User programs may
512 place non-essential data in this directory. Flushing this
513 directory should have no effect on operation of programs,
514 except for increased runtimes necessary to rebuild these
515 caches. If an application finds
516 <varname>$XDG_CACHE_HOME</varname> set is should use the
517 directory specified in it instead of this
518 directory.</para></listitem>
522 <term><filename>~/.config</filename></term>
524 <listitem><para>Application configuration and state. When a
525 new user is created this directory will be empty or not exist
526 at all. Applications should fall back to defaults should their
527 configuration or state in this directory be missing. If an
528 application finds <varname>$XDG_CONFIG_HOME</varname> set is
529 should use the directory specified in it instead of this
530 directory.</para></listitem>
534 <term><filename>~/.local/bin</filename></term>
536 <listitem><para>Executables that shall appear in the user's
537 <varname>$PATH</varname> search path. It is recommended not to
538 place executables in this directory that are not useful for
539 invocation from a shell; these should be placed in a
540 subdirectory of <filename>~/.local/lib</filename> instead.
541 Care should be taken when placing architecture-dependent
542 binaries in this place which might be problematic if the home
543 directory is shared between multiple hosts with different
544 architectures.</para></listitem>
548 <term><filename>~/.local/lib</filename></term>
550 <listitem><para>Static, private vendor data that is compatible
551 with all architectures.</para></listitem>
555 <term><filename>~/.local/lib/<replaceable>arch-id</replaceable></filename></term>
557 <listitem><para>Location for placing public dynamic libraries.
558 The architecture identifier to use, is defined on <ulink
559 url="https://wiki.debian.org/Multiarch/Tuples">Multiarch
560 Architecture Specifiers (Tuples)</ulink>
561 list.</para></listitem>
565 <term><filename>~/.local/share</filename></term>
567 <listitem><para>Resources shared between multiple packages,
568 such as fonts or artwork. Usually, the precise location and
569 format of files stored below this directory is subject to
570 specifications that ensure interoperability. If an application
571 finds <varname>$XDG_DATA_HOME</varname> set is should use the
572 directory specified in it instead of this
573 directory.</para></listitem>
581 <title>Unprivileged Write Access</title>
583 <para>Unprivileged processes generally lack write access to most
584 of the hierarchy.</para>
586 <para>The exceptions for normal users are
587 <filename>/tmp</filename>,
588 <filename>/var/tmp</filename>,
589 <filename>/dev/shm</filename>, as well as the home directory
590 <varname>$HOME</varname> (usually found below
591 <filename>/home</filename>) and the runtime directory
592 <varname>$XDG_RUNTIME_DIR</varname> (found below
593 <filename>/run/user</filename>) of the user, which are all
596 <para>For unprivileged system processes only
597 <filename>/tmp</filename>,
598 <filename>/var/tmp</filename> and
599 <filename>/dev/shm</filename> are writable. If an
600 unprivileged system process needs a private, writable directory in
601 <filename>/var</filename> or <filename>/run</filename>, it is
602 recommended to either create it before dropping privileges in the
603 daemon code, to create it via
604 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
605 fragments during boot, or via the
606 <varname>RuntimeDirectory=</varname> directive of service units
608 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
613 <title>Node Types</title>
615 <para>Unix file systems support different types of file nodes,
616 including regular files, directories, symlinks, character and
617 block device nodes, sockets and FIFOs.</para>
619 <para>It is strongly recommended that <filename>/dev</filename> is
620 the only location below which device nodes shall be placed.
621 Similar, <filename>/run</filename> shall be the only location to
622 place sockets and FIFOs. Regular files, directories and symlinks
623 may be used in all directories.</para>
627 <title>System Packages</title>
629 <para>Developers of system packages should follow strict rules
630 when placing their own files in the file system. The following
631 table lists recommended locations for specific types of files
632 supplied by the vendor.</para>
635 <title>System Package Vendor Files Locations</title>
636 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
637 <colspec colname="directory" />
638 <colspec colname="purpose" />
641 <entry>Directory</entry>
642 <entry>Purpose</entry>
647 <entry><filename>/usr/bin</filename></entry>
648 <entry>Package executables that shall appear in the <varname>$PATH</varname> executable search path, compiled for any of the supported architectures compatible with the operating system. It is not recommended to place internal binaries or binaries that are not commonly invoked from the shell in this directory, such as daemon binaries. As this directory is shared with most other packages of the system special care should be taken to pick unique names for files placed here, that are unlikely to clash with other package's files.</entry>
651 <entry><filename>/usr/lib/<replaceable>arch-id</replaceable></filename></entry>
652 <entry>Public shared libraries of the package. As above, be careful with using too generic names, and pick unique names for your libraries to place here to avoid name clashes.</entry>
655 <entry><filename>/usr/lib/<replaceable>package</replaceable></filename></entry>
656 <entry>Private, static vendor resources of the package, including private binaries and libraries, or any other kind of read-only vendor data.</entry>
659 <entry><filename>/usr/lib/<replaceable>arch-id</replaceable>/<replaceable>package</replaceable></filename></entry>
660 <entry>Private other vendor resources of the package that are architecture-specific and cannot be shared between architectures. Note that this generally does not include private executables since binaries of a specific architecture may be freely invoked from any other supported system architecture.</entry>
663 <entry><filename>/usr/include/<replaceable>package</replaceable></filename></entry>
664 <entry>Public C/C++ APIs of public shared libraries of the package.</entry>
670 <para>Additional static vendor files may be installed in the
671 <filename>/usr/share</filename> hierarchy, to the locations
672 defined by the various relevant specifications.</para>
674 <para>During runtime and for local configuration and state
675 additional directories are defined:</para>
678 <title>System Package Variable Files Locations</title>
679 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
680 <colspec colname="directory" />
681 <colspec colname="purpose" />
684 <entry>Directory</entry>
685 <entry>Purpose</entry>
690 <entry><filename>/etc/<replaceable>package</replaceable></filename></entry>
691 <entry>System-specific configuration for the package. It is recommended to default to safe fallbacks if this configuration is missing, if this is possible. Alternatively, a <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> fragment may be used to copy or symlink the necessary files and directories from <filename>/usr/share/factory</filename> during boot, via the <literal>L</literal> or <literal>C</literal> directives.</entry>
694 <entry><filename>/run/<replaceable>package</replaceable></filename></entry>
695 <entry>Runtime data for the package. Packages must be able to create the necessary subdirectories in this tree on their own, since the directory is flushed automatically on boot. Alternatively, a <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> fragment may be used to create the necessary directories during boot. Alternatively, the <varname>RuntimeDirectory=</varname> directive of service units may be used (see <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for details.)</entry>
698 <entry><filename>/run/log/<replaceable>package</replaceable></filename></entry>
699 <entry>Runtime log data for the package. As above, the package needs to make sure to create this directory if necessary, as it will be flushed on every boot.</entry>
702 <entry><filename>/var/cache/<replaceable>package</replaceable></filename></entry>
703 <entry>Persistent cache data of the package. If this directory is flushed the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary.</entry>
706 <entry><filename>/var/lib/<replaceable>package</replaceable></filename></entry>
707 <entry>Persistent private data of the package. This is the primary place to put persistent data that does not fall into the other categories listed. Packages should be able to create the necessary subdirectories in this tree on their own, since the directory might be missing on boot. Alternatively, a <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> fragment may be used to create the necessary directories during boot.</entry>
710 <entry><filename>/var/log/<replaceable>package</replaceable></filename></entry>
711 <entry>Persistent log data of the package. As above, the package should make sure to create this directory if necessary, as it might be missing.</entry>
714 <entry><filename>/var/spool/<replaceable>package</replaceable></filename></entry>
715 <entry>Persistent spool/queue data of the package. As above, the package should make sure to create this directory if necessary, as it might be missing.</entry>
723 <title>User Packages</title>
725 <para>Programs running in user context should follow strict rules
726 when placing their own files in the user's home directory. The
727 following table lists recommended locations in the home directory
728 for specific types of files supplied by the vendor if the
729 application is installed in the home directory. (Note however,
730 that user applications installed system-wide should follow the
731 rules outlined above regarding placing vendor files.)</para>
734 <title>User Package Vendor File Locations</title>
735 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
736 <colspec colname="directory" />
737 <colspec colname="purpose" />
740 <entry>Directory</entry>
741 <entry>Purpose</entry>
746 <entry><filename>~/.local/bin</filename></entry>
747 <entry>Package executables that shall appear in the <varname>$PATH</varname> executable search path. It is not recommended to place internal executables or executables that are not commonly invoked from the shell in this directory, such as daemon executables. As this directory is shared with most other packages of the user special care should be taken to pick unique names for files placed here, that are unlikely to clash with other package's files.</entry>
750 <entry><filename>~/.local/lib/<replaceable>arch-id</replaceable></filename></entry>
751 <entry>Public shared libraries of the package. As above, be careful with using too generic names, and pick unique names for your libraries to place here to avoid name clashes.</entry>
754 <entry><filename>~/.local/lib/<replaceable>package</replaceable></filename></entry>
755 <entry>Private, static vendor resources of the package, compatible with any architecture, or any other kind of read-only vendor data.</entry>
758 <entry><filename>~/.local/lib/<replaceable>arch-id</replaceable>/<replaceable>package</replaceable></filename></entry>
759 <entry>Private other vendor resources of the package that are architecture-specific and cannot be shared between architectures.</entry>
765 <para>Additional static vendor files may be installed in the
766 <filename>~/.local/share</filename> hierarchy, to the locations
767 defined by the various relevant specifications.</para>
769 <para>During runtime and for local configuration and state
770 additional directories are defined:</para>
773 <title>User Package Variable File Locations</title>
774 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
775 <colspec colname="directory" />
776 <colspec colname="purpose" />
779 <entry>Directory</entry>
780 <entry>Purpose</entry>
785 <entry><filename>~/.config/<replaceable>package</replaceable></filename></entry>
786 <entry>User-specific configuration and state for the package. It is required to default to safe fallbacks if this configuration is missing.</entry>
789 <entry><filename><varname>$XDG_RUNTIME_DIR</varname>/<replaceable>package</replaceable></filename></entry>
790 <entry>User runtime data for the package.</entry>
793 <entry><filename>~/.cache/<replaceable>package</replaceable></filename></entry>
794 <entry>Persistent cache data of the package. If this directory is flushed the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary.</entry>
802 <title>See Also</title>
804 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
805 <citerefentry project='man-pages'><refentrytitle>hier</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
806 <citerefentry><refentrytitle>systemd-path</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
807 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
808 <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
809 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
810 <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
811 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>