← 返回命令列表

Linux command

systemd-tmpfiles 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Create

systemd-tmpfiles --create

Clean up

systemd-tmpfiles --clean

Remove

systemd-tmpfiles --remove

Apply

systemd-tmpfiles --create --user

Execute

systemd-tmpfiles --create --boot

Apply

systemd-tmpfiles --create --prefix=[/tmp]

Create, clean, and remove

systemd-tmpfiles --create --clean --remove

说明

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.

参数

--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

FAQ

What is the systemd-tmpfiles command used for?

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.

How do I run a basic systemd-tmpfiles example?

Run `systemd-tmpfiles --create` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --create do in systemd-tmpfiles?

Create files and directories as configured