Action

Removes everything from directories configured for the specified unit.

systemd.timer units clear timestamp data when Persistent= is supplied.

Example command

systemctl clean dirty.service

Options

--what

Example

Clean all directories

systemctl clean --what=all badstate.service

Clean the log directory

systemctl clean --what=logs badlogs.service

Options

  • configuration
  • state
  • cache
  • logs
  • runtime
  • all

Default paths

Directory Below path for system units Below path for user units Environment variable set
RuntimeDirectory= /run/ $XDG_RUNTIME_DIR $RUNTIME_DIRECTORY
StateDirectory= /var/lib/ $XDG_CONFIG_HOME $STATE_DIRECTORY
CacheDirectory= /var/cache/ $XDG_CACHE_HOME $CACHE_DIRECTORY
LogsDirectory= /var/log/ $XDG_CONFIG_HOME/log/ $LOGS_DIRECTORY
ConfigurationDirectory= /etc/ $XDG_CONFIG_HOME $CONFIGURATION_DIRECTORY