I run a process which outputs data I would like to store somewhere so that another process, at some point, can read that file.

Is there a traditional place where such files are stored?

  • I could use /var/run or /run but these are expected to be cleared when rebooting - I want my files to be persistent across reboots
  • I could use /myowndircetoryforpersistantfiles and it would work, I am curious if there is something intended for such use

Maybe /var/log? (though this is not really a log file)


Depending on the type of data, you could use /var/lib, or /var/tmp. From the Filesystem Hierarchy Standard 3.0:

  • /var/lib:

    This hierarchy holds state information pertaining to an application or the system. State information is data that programs modify while they run, and that pertains to one specific host. [...]

    State information should generally remain valid after a reboot, should not be logging output, and should not be spooled data.

    An application (or a group of inter-related applications) must use a subdirectory of /var/lib for its data. [...]

    /var/lib/<name> is the location that must be used for all distribution packaging support. Different distributions may use different names, of course.

  • /var/tmp:

    The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.

    Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.

If you can consider the data to be "state information" for the group of applications comprising the two processes, then /var/lib/<subdir> seems to be a good fit. If not, /var/tmp/<...>.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.