LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

systemd-tmpfiles

Manage temporary files and directories

TLDR

Create files and directories as specified in configuration
$ systemd-tmpfiles --create
copy
Clean up files and directories with age parameters
$ systemd-tmpfiles --clean
copy
Remove files and directories as specified in configuration
$ systemd-tmpfiles --remove
copy
Apply operations for user-specific configurations
$ systemd-tmpfiles --create --user
copy
Execute lines marked for early boot
$ systemd-tmpfiles --create --boot
copy
Apply only to paths under a specific prefix
$ systemd-tmpfiles --create --prefix=[/tmp]
copy
Create, clean, and remove in a single invocation
$ systemd-tmpfiles --create --clean --remove
copy

SYNOPSIS

systemd-tmpfiles [options] [configfile...]

DESCRIPTION

systemd-tmpfiles creates, deletes, and cleans up volatile and temporary files and directories. Configuration files in /etc/tmpfiles.d/, /usr/lib/tmpfiles.d/, and related directories define what actions to take.The tool is automatically invoked during system boot by systemd services. Manual execution is typically only needed for testing configurations or one-time cleanup operations.

PARAMETERS

--create

Create files and directories as configured
--clean
Clean up files older than configured age
--remove
Remove files and directories
--user
Apply user configuration
--boot
Execute boot-time entries
--purge
Delete all files and directories created by the specified configuration files
--prefix path
Only apply rules with paths starting with specified prefix (repeatable)
--exclude-prefix path
Ignore rules with paths starting with specified prefix (repeatable)
-E
Shortcut for excluding /dev, /proc, /run, and /sys hierarchies
--root path
Prefix all paths with the given alternate root directory
--replace path
Use command-line arguments instead of the specified configuration file
--cat-config
Print the contents of configuration files to stdout
--no-pager
Do not pipe output into a pager
-h, --help
Print help text and exit

CAVEATS

Running manually is usually not needed as systemd handles this automatically. It is possible to combine --create, --clean, and --remove in one invocation. Configuration syntax errors may prevent proper cleanup. Age-based cleanup requires properly configured time values. Part of the systemd suite.

SEE ALSO

Copied to clipboard
Kai