Natenoms Wiki

Weil Teilen Spaß macht :)




Temporary files in KDE/SC

KDE SC uses several directories on your filesystem to store temporary files. Most of those files are unneccesary and can be removed when KDE is not running; at least I do that :P

Those directories are (defaults in Gentoo):

  • /tmp/kde-$USER
  • /var/tmp/kdecache-$USER/
  • /tmp/ksocket-$USER/

More information about those directories can be found here.

Disadvantages of different places for files

  • If one uses an encrypted filesystem for /home only, sensible data is still accessible in the non encrypted / filesystem.
  • Also in a fully encrypted filesystem you may want to have your data in your user directory.
  • In my case I don't like the amout of data that is used on my very small / partition.

Adapt paths

With environment variables one can tell KDE to use other paths for those directories.

KDE uses KDETMP and KDEVARTMP. To change them while KDE starts, create the file '' in $KDEHOME/env:

export KDETMP="/home/username/.kde4/temporary/"
export KDEVARTMP="/home/username/.kde4/temporary/"
#KDE does not create both directories, they must exist already on KDE's start.
[ -d $KDETMP ] || mkdir -p $KDETMP
[ -d $KDEVARTMP ] || mkdir -p $KDEVARTMP

It is important that the file ends with .sh so KDE really executes it. Technical information about this can be found here.

Do not forget to make it executable:

chmod a+x

The script checks whether both directories exist and creates them if, because KDE fails to start if they do not exist.

Now you have the following directories in /home/username/.kde4:

  • kdecache-username
  • kde-username
  • ksocket-username

The first directory can be removed from time to time, the last two can be removed on startup/shutdown of your system on a regular basis.

en/linux/kde/tempfiles.txt · Zuletzt geändert: 2020/06/01 23:14 (Externe Bearbeitung)