How to change KDE Settings through the terminal?

I feel this is kind of an obvious question to ask? But honestly I could not find an answer that is not behind a Reddit Loginwall.

How to change settings from the CLI, like gsettings on GNOME?

I think it would be awesome to document how every setting in Systemsettings is done in the background. It is likely pretty complex, sometimes multiple actions etc?

Why is this needed?

In setupscripts it is important that certain settings can be automated.

For example

  • setting certain directories to “ignore” in Baloo
  • changing some defaults
  • enable or configure kup backups