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
56 file system hierarchy inspired by UNIX, more
57 specifically the hierarchy 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><refentrytitle>hier</refentrytitle><manvolnum>7</manvolnum></citerefentry>. This
61 manual page describes a more minimal, modernized
62 subset of these specifications that defines more
63 strictly the suggestions and restrictions systemd
64 makes on the file system hierarchy.</para>
68 <title>General Structure</title>
72 <term><filename>/</filename></term>
73 <listitem><para>The file system
74 root. Usually writable, but this is
75 not required. Possibly a temporary
76 file system (<literal>tmpfs</literal>). Not shared with
77 other hosts (unless read-only).
82 <term><filename>/boot</filename></term>
83 <listitem><para>The boot partition
84 used for bringing up the system. On
85 EFI systems this is possibly the EFI
86 System Partition, also see
87 <citerefentry><refentrytitle>systemd-boot-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>. This
88 directory is usually strictly local
89 to the host, and should be considered
90 read-only, except when a new kernel or
91 boot loader is installed. This
92 directory only exists on systems that
93 run on physical or emulated hardware
95 loaders.</para></listitem>
99 <term><filename>/etc</filename></term>
100 <listitem><para>System-specific
101 configuration. This directory may or
102 may not be read-only. Frequently, this
103 directory is pre-populated with
104 vendor-supplied configuration files,
105 but applications should not make
106 assumptions about this directory
107 being fully populated or populated at
108 all, and should fall back to defaults
109 if configuration is missing.</para></listitem>
113 <term><filename>/home</filename></term>
114 <listitem><para>The location for
116 directories. Possibly shared with
117 other systems, and never
118 read-only. This directory should only
119 be used for normal users, never for
120 system users. This directory and
121 possibly the directories contained
122 within it might only become available
123 or writable in late boot or even only
124 after user authentication. This directory
125 might be placed on limited-functionality
126 network file systems, hence
127 applications should not assume the
128 full set of file API is available on
129 this directory. Applications should
130 generally not reference this directory
131 directly, but via the per-user
132 <varname>$HOME</varname> environment
133 variable, or via the home directory
135 database.</para></listitem>
139 <term><filename>/root</filename></term>
140 <listitem><para>The home directory of
141 the root user. The root user's home
142 directory is located outside of
143 <filename>/home</filename> in order to
144 make sure the root user may log in
145 even without <filename>/home</filename>
147 mounted.</para></listitem>
151 <term><filename>/srv</filename></term>
152 <listitem><para>The place to store
153 general server payload, managed by the
154 administrator. No restrictions are
155 made how this directory is organized
156 internally. Generally writable, and
157 possibly shared among systems. This
158 directory might become available or
159 writable only very late during
160 boot.</para></listitem>
164 <term><filename>/tmp</filename></term>
165 <listitem><para>The place for small
166 temporary files. This directory is
168 a <literal>tmpfs</literal> instance, and
169 should hence not be used for larger
171 <filename>/var/tmp</filename> for
172 larger files.) Since the directory is
173 accessible to other users of the
174 system it is essential that this
175 directory is only written to with the
176 <citerefentry><refentrytitle>mkstemp</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
177 <citerefentry><refentrytitle>mkdtemp</refentrytitle><manvolnum>3</manvolnum></citerefentry>
178 and related calls. This directory is
179 usually flushed at boot-up. Also,
180 files that are not accessed within a
181 certain time are usually automatically
182 deleted. If applications find the
184 <varname>$TMPDIR</varname> set they
185 should prefer using the directory
186 specified in it over directly
188 <filename>/tmp</filename> (see <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details).</para></listitem>
195 <title>Runtime Data</title>
199 <term><filename>/run</filename></term>
201 <literal>tmpfs</literal> file system
202 for system packages to place runtime
203 data in. This directory is flushed on
204 boot, and generally writable for
206 only. Always writable.</para></listitem>
210 <term><filename>/run/log</filename></term>
211 <listitem><para>Runtime system
212 logs. System components may place
213 private logs in this directory. Always
215 <filename>/var/log</filename> might
217 yet.</para></listitem>
221 <term><filename>/run/user</filename></term>
222 <listitem><para>Contains per-user
223 runtime directories, each usually
225 <literal>tmpfs</literal>
226 instances. Always writable, flushed at
227 each reboot and when the user logs
228 out. User code should not reference
229 this directory directly, but via the
230 <varname>$XDG_RUNTIME_DIR</varname>
231 environment variable, as documented in
233 url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG
235 Specification</ulink>.</para></listitem>
241 <title>Vendor-supplied Operating System Resources</title>
246 <term><filename>/usr</filename></term>
247 <listitem><para>Vendor-supplied
248 operating system resources. Usually
249 read-only, but this is not
250 required. Possibly shared between
251 multiple hosts. This directory should
252 not be modified by the administrator,
253 except when installing or removing
255 packages.</para></listitem>
259 <term><filename>/usr/bin</filename></term>
260 <listitem><para>Binaries and
261 executables for user commands, that
263 <varname>$PATH</varname> search
264 path. It is recommended not to place
265 binaries in this directory that are
266 not useful for invocation from a shell
267 (such as daemon binaries); these
268 should be placed in a subdirectory of
269 <filename>/usr/lib</filename>
270 instead.</para></listitem>
274 <term><filename>/usr/include</filename></term>
275 <listitem><para>C and C++ API header
277 libraries.</para></listitem>
281 <term><filename>/usr/lib</filename></term>
282 <listitem><para>Static, private vendor
283 data that is compatible with all
284 architectures (though not necessarily
285 architecture-independent). Note that
286 this includes internal executables or
287 other binaries that are not regularly
288 invoked from a shell. Such binaries
289 may be for any architecture supported
290 by the system. Do not place public
291 libraries in this directory, use
292 <varname>$libdir</varname> (see
293 below), instead.</para></listitem>
297 <term><filename>/usr/lib/<replaceable>arch-id</replaceable></filename></term>
298 <listitem><para>Location for placing
299 dynamic libraries, called <varname>$libdir</varname>.
300 The architecture identifier to use, is defined on <ulink
301 url="https://wiki.debian.org/Multiarch/Tuples">Multiarch Architecture Specifiers (Tuples)</ulink>
302 list. Legacy locations of <varname>$libdir</varname> are
303 <filename>/usr/lib</filename>,
304 <filename>/usr/lib64</filename>.
305 This directory should not
306 be used for package-specific data,
308 architecture-dependent, too. To query
309 <varname>$libdir</varname> for the
310 primary architecture of the system,
312 <programlisting># pkg-config --variable=libdir systemd</programlisting></para></listitem>
316 <term><filename>/usr/share</filename></term>
317 <listitem><para>Resources shared
318 between multiple packages, such as
319 documentation, man pages, time zone
320 information, fonts and other
321 resources. Usually, the precise
322 location and format of files stored
323 below this directory is subject to
324 specifications that ensure
325 interoperability.</para></listitem>
329 <term><filename>/usr/share/doc</filename></term>
330 <listitem><para>Documentation for the
331 operating system or system
332 packages.</para></listitem>
336 <term><filename>/usr/share/factory/etc</filename></term>
337 <listitem><para>Repository for
338 vendor-supplied default configuration
339 files. This directory should be
340 populated with pristine vendor versions
341 of all configuration files that may be
343 <filename>/etc</filename>. This is
344 useful to compare the local
345 configuration of a system with vendor
346 defaults and to populate the local
348 defaults.</para></listitem>
352 <term><filename>/usr/share/factory/var</filename></term>
354 <listitem><para>Similar to
355 <filename>/usr/share/factory/etc</filename>
356 but for vendor versions of files in
357 the variable, persistent data
359 <filename>/var</filename>.</para></listitem>
366 <title>Persistent Variable System Data</title>
370 <term><filename>/var</filename></term>
371 <listitem><para>Persistent, variable
372 system data. Must be writable. This
373 directory might be pre-populated with
374 vendor-supplied data, but applications
375 should be able to reconstruct
376 necessary files and directories in
377 this subhierarchy should they be
378 missing, as the system might start up
379 without this directory being
380 populated. Persistency is recommended,
381 but optional, to support ephemeral
382 systems. This directory might become
383 available or writable only very late
384 during boot. Components that are
385 required to operate during early boot
386 hence shall not unconditionally rely
387 on this directory.</para></listitem>
391 <term><filename>/var/cache</filename></term>
392 <listitem><para>Persistent system
393 cache data. System components may
394 place non-essential data in this
395 directory. Flushing this directory
396 should have no effect on operation of
397 programs, except for increased
398 runtimes necessary to rebuild these
399 caches.</para></listitem>
403 <term><filename>/var/lib</filename></term>
404 <listitem><para>Persistent system
405 data. System components may
406 place private data in this
407 directory.</para></listitem>
411 <term><filename>/var/log</filename></term>
412 <listitem><para>Persistent system
413 logs. System components may place
414 private logs in this directory, though
415 it is recommended to do most logging
417 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
419 <citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry>
420 calls.</para></listitem>
424 <term><filename>/var/spool</filename></term>
425 <listitem><para>Persistent system
426 spool data, such as printer or mail
427 queues.</para></listitem>
431 <term><filename>/var/tmp</filename></term>
432 <listitem><para>The place for larger
433 and persistent temporary files. In
434 contrast to <filename>/tmp</filename>
435 this directory is usually mounted from
436 a persistent physical file system and
437 can thus accept larger files. (Use
438 <filename>/tmp</filename> for smaller
439 files.) This directory is generally
440 not flushed at boot-up, but time-based
441 cleanup of files that have not been
442 accessed for a certain time is
443 applied. The same security
445 <filename>/tmp</filename> apply, and
447 <citerefentry><refentrytitle>mkstemp</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
448 <citerefentry><refentrytitle>mkdtemp</refentrytitle><manvolnum>3</manvolnum></citerefentry>
449 or similar calls should be used to
450 make use of this directory. If
451 applications find the environment
452 variable <varname>$TMPDIR</varname>
453 set they should prefer using the
454 directory specified in it over
456 <filename>/var/tmp</filename> (see <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details).
464 <title>Virtual Kernel and API File Systems</title>
468 <term><filename>/dev</filename></term>
469 <listitem><para>The root directory for
470 device nodes. Usually this directory
472 <literal>devtmpfs</literal> instance,
473 but might be of a different type in
474 sandboxed/containerized setups. This
475 directory is managed jointly by the
477 <citerefentry><refentrytitle>systemd-udevd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
478 and should not be written to by other
479 components. A number of special
480 purpose virtual file systems might be
482 directory.</para></listitem>
486 <term><filename>/dev/shm</filename></term>
487 <listitem><para>Place for POSIX shared
488 memory segments, as created via
489 <citerefentry><refentrytitle>shm_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>. This
490 directory is flushed on boot, and is a
491 <literal>tmpfs</literal> file
492 system. Since all users have write
493 access to this directory, special care
494 should be taken to avoid name clashes
495 and vulnerabilities. For normal users,
496 shared memory segments in this
497 directory are usually deleted when the
498 user logs out. Usually it is a better
499 idea to use memory mapped files in
500 <filename>/run</filename> (for system
502 <varname>$XDG_RUNTIME_DIR</varname>
503 (for user programs) instead of POSIX
504 shared memory segments, since those
505 directories are not world-writable and
506 hence not vulnerable to
507 security-sensitive name
508 clashes.</para></listitem>
512 <term><filename>/proc</filename></term>
513 <listitem><para>A virtual kernel file
514 system exposing the process list and
515 other functionality. This file system
516 is mostly an API to interface with the
517 kernel and not a place where normal
518 files may be stored. For details, see
519 <citerefentry><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>. A
520 number of special purpose virtual file
521 systems might be mounted below this
522 directory.</para></listitem>
526 <term><filename>/proc/sys</filename></term>
527 <listitem><para>A hierarchy below
528 <filename>/proc</filename> that
529 exposes a number of kernel
530 tunables. The primary way to configure
531 the settings in this API file tree is
533 <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
534 files. In sandboxed/containerized
535 setups this directory is generally
536 mounted read-only.</para></listitem>
540 <term><filename>/sys</filename></term>
541 <listitem><para>A virtual kernel file
542 system exposing discovered devices and
543 other functionality. This file system
544 is mostly an API to interface with the
545 kernel and not a place where normal
546 files may be stored. In
547 sandboxed/containerized setups this
548 directory is generally mounted
549 read-only. A number of special purpose
550 virtual file systems might be mounted
552 directory.</para></listitem>
560 <title>Compatibility Symlinks</title>
564 <term><filename>/bin</filename></term>
565 <term><filename>/sbin</filename></term>
566 <term><filename>/usr/sbin</filename></term>
568 <listitem><para>These compatibility
570 <filename>/usr/bin</filename>,
571 ensuring that scripts and binaries
572 referencing these legacy paths
573 correctly find their binaries.</para></listitem>
577 <term><filename>/lib</filename></term>
579 <listitem><para>This compatibility
581 <filename>/usr/lib</filename>,
582 ensuring that programs referencing
583 this legacy path correctly find
584 their resources.</para></listitem>
588 <term><filename>/lib64</filename></term>
590 <listitem><para>On some architecture
591 ABIs this compatibility symlink points
592 to <varname>$libdir</varname>,
593 ensuring that binaries referencing
594 this legacy path correctly find their
595 dynamic loader. This symlink only
596 exists on architectures whose ABI
597 places the dynamic loader in this
598 path.</para></listitem>
602 <term><filename>/var/run</filename></term>
604 <listitem><para>This compatibility
606 <filename>/run</filename>, ensuring
607 that programs referencing this legacy
608 path correctly find their runtime
609 data.</para></listitem>
616 <title>Home Directory</title>
618 <para>User applications may want to place files and
619 directories in the user's home directory. They should
620 follow the following basic structure. Note that some
621 of these directories are also standardized (though
622 more weakly) by the <ulink
623 url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG
624 Base Directory Specification</ulink>.</para>
628 <term><filename>~/.cache</filename></term>
630 <listitem><para>Persistent user cache
631 data. User programs may place
632 non-essential data in this
633 directory. Flushing this directory
634 should have no effect on operation of
635 programs, except for increased
636 runtimes necessary to rebuild these
637 caches. If an application finds
638 <varname>$XDG_CACHE_HOME</varname> set
639 is should use the directory specified
640 in it instead of this
641 directory.</para></listitem>
645 <term><filename>~/.config</filename></term>
647 <listitem><para>Application
648 configuration and state. When a new
649 user is created this directory will be
650 empty or not exist at
651 all. Applications should fall back to
652 defaults should their configuration or
653 state in this directory be missing. If
655 <varname>$XDG_CONFIG_HOME</varname> set
656 is should use the directory specified
657 in it instead of this
658 directory.</para></listitem>
662 <term><filename>~/.local/bin</filename></term>
664 <listitem><para>Executables that shall
666 <varname>$PATH</varname> search
667 path. It is recommended not to place
668 executables in this directory that are
669 not useful for invocation from a
670 shell; these should be placed in a
672 <filename>~/.local/lib</filename>
673 instead. Care should be taken when
674 placing architecture-dependent
675 binaries in this place which might be
676 problematic if the home directory is
677 shared between multiple hosts with
679 architectures.</para></listitem>
683 <term><filename>~/.local/lib</filename></term>
685 <listitem><para>Static, private vendor
686 data that is compatible with all
687 architectures.</para></listitem>
691 <term><filename>~/.local/lib/<replaceable>arch-id</replaceable></filename></term>
693 <listitem><para>Location for placing
694 public dynamic libraries. The architecture
695 identifier to use, is defined on <ulink
696 url="https://wiki.debian.org/Multiarch/Tuples">Multiarch Architecture Specifiers (Tuples)</ulink>
697 list.</para></listitem>
701 <term><filename>~/.local/share</filename></term>
703 <listitem><para>Resources shared
704 between multiple packages, such as
705 fonts or artwork. Usually, the precise
706 location and format of files stored
707 below this directory is subject to
708 specifications that ensure
711 <varname>$XDG_DATA_HOME</varname> set
712 is should use the directory specified
713 in it instead of this
714 directory.</para></listitem>
722 <title>Unpriviliged Write Access</title>
724 <para>Unpriviliged processes generally lack
725 write access to most of the hierarchy.</para>
727 <para>The exceptions for normal users are
728 <filename>/tmp</filename>,
729 <filename>/var/tmp</filename>,
730 <filename>/dev/shm</filename>, as well as the home
731 directory <varname>$HOME</varname> (usually found
732 below <filename>/home</filename>) and the runtime
733 directory <varname>$XDG_RUNTIME_DIR</varname> (found
734 below <filename>/run/user</filename>) of the
735 user, which are all writable.</para>
737 <para>For unpriviliged system processes only
738 <filename>/tmp</filename>,
739 <filename>/var/tmp</filename> and
740 <filename>/dev/shm</filename> are writable. If an
741 unpriviliged system process needs a private, writable
742 directory in <filename>/var</filename> or
743 <filename>/run</filename>, it is recommended to either
744 create it before dropping priviliges in the daemon
745 code, to create it via
746 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
747 fragments during boot, or via the
748 <varname>RuntimeDirectory=</varname> directive of
750 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
755 <title>Node Types</title>
757 <para>Unix file systems support different types of file
758 nodes, including regular files, directories, symlinks,
759 character and block device nodes, sockets and FIFOs.</para>
761 <para>It is strongly recommended that
762 <filename>/dev</filename> is the only location below
763 which device nodes shall be placed. Similar,
764 <filename>/run</filename> shall be the only location
765 to place sockets and FIFOs. Regular files,
766 directories and symlinks may be used in all
771 <title>System Packages</title>
773 <para>Developers of system packages should follow
774 strict rules when placing their own files in the file
775 system. The following table lists recommended
776 locations for specific types of files supplied by the
780 <title>System Package Vendor Files Locations</title>
781 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
782 <colspec colname="directory" />
783 <colspec colname="purpose" />
786 <entry>Directory</entry>
787 <entry>Purpose</entry>
792 <entry><filename>/usr/bin</filename></entry>
793 <entry>Package executables that shall appear in the <varname>$PATH</varname> executable search path, compiled for the primary architecture of 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>
796 <entry><filename>/usr/lib/<replaceable>arch-id</replaceable></filename></entry>
797 <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>
800 <entry><filename>/usr/lib/<replaceable>package</replaceable></filename></entry>
801 <entry>Private, static vendor resources of the package, including private binaries and libraries, or any other kind of read-only vendor data.</entry>
804 <entry><filename>/usr/lib/<replaceable>arch-id</replaceable>/<replaceable>package</replaceable></filename></entry>
805 <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 exectuables since binaries of a specific architecture may be freely invoked from any other supported system architecture.</entry>
808 <entry><filename>/usr/include/<replaceable>package</replaceable></filename></entry>
809 <entry>Public C/C++ APIs of public shared libraries of the package.</entry>
815 <para>Additional static vendor files may be installed
816 in the <filename>/usr/share</filename> hierarchy, to
817 the locations defined by the various relevant
818 specifications.</para>
820 <para>During runtime and for local configuration and
821 state additional directories are defined:</para>
824 <title>System Package Variable Files Locations</title>
825 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
826 <colspec colname="directory" />
827 <colspec colname="purpose" />
830 <entry>Directory</entry>
831 <entry>Purpose</entry>
836 <entry><filename>/etc/<replaceable>package</replaceable></filename></entry>
837 <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>
840 <entry><filename>/run/<replaceable>package</replaceable></filename></entry>
841 <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>
844 <entry><filename>/run/log/<replaceable>package</replaceable></filename></entry>
845 <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>
848 <entry><filename>/var/cache/<replaceable>package</replaceable></filename></entry>
849 <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>
852 <entry><filename>/var/lib/<replaceable>package</replaceable></filename></entry>
853 <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>
856 <entry><filename>/var/log/<replaceable>package</replaceable></filename></entry>
857 <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>
860 <entry><filename>/var/spool/<replaceable>package</replaceable></filename></entry>
861 <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>
869 <title>User Packages</title>
871 <para>Programs running in user context should follow
872 strict rules when placing their own files in the
873 user's home directory. The following table lists
874 recommended locations in the home directory for
875 specific types of files supplied by the vendor if the
876 application is installed in the home directory. (Note
877 however, that user applications installed system-wide
878 should follow the rules outlined above regarding
879 placing vendor files.)</para>
882 <title>User Package Vendor File Locations</title>
883 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
884 <colspec colname="directory" />
885 <colspec colname="purpose" />
888 <entry>Directory</entry>
889 <entry>Purpose</entry>
894 <entry><filename>~/.local/bin</filename></entry>
895 <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>
898 <entry><filename>~/.local/lib/<replaceable>arch-id</replaceable></filename></entry>
899 <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>
902 <entry><filename>~/.local/lib/<replaceable>package</replaceable></filename></entry>
903 <entry>Private, static vendor resources of the package, compatible wih any architecture, or any other kind of read-only vendor data.</entry>
906 <entry><filename>~/.local/lib/<replaceable>arch-id</replaceable>/<replaceable>package</replaceable></filename></entry>
907 <entry>Private other vendor resources of the package that are architecture-specific and cannot be shared between architectures.</entry>
913 <para>Additional static vendor files may be installed
914 in the <filename>~/.local/share</filename> hierarchy,
915 to the locations defined by the various relevant
916 specifications.</para>
918 <para>During runtime and for local configuration and
919 state additional directories are defined:</para>
922 <title>User Package Variable File Locations</title>
923 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
924 <colspec colname="directory" />
925 <colspec colname="purpose" />
928 <entry>Directory</entry>
929 <entry>Purpose</entry>
934 <entry><filename>~/.config/<replaceable>package</replaceable></filename></entry>
935 <entry>User-specific configuration and state for the package. It is required to default to safe fallbacks if this configuration is missing.</entry>
938 <entry><filename><varname>$XDG_RUNTIME_DIR</varname>/<replaceable>package</replaceable></filename></entry>
939 <entry>User runtime data for the package.</entry>
942 <entry><filename>~/.cache/<replaceable>package</replaceable></filename></entry>
943 <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>
951 <title>See Also</title>
953 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
954 <citerefentry><refentrytitle>hier</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
955 <citerefentry><refentrytitle>systemd-boot-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
956 <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
957 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
958 <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
959 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>