Difference between revisions of "KDE System Administration/KDE Filesystem Hierarchy"

Jump to: navigation, search
m (fix typos)
(typos, spelling, grammar, style)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
KDE defines a filesystem hierarchy which is used by the KDE environment
+
KDE defines a filesystem hierarchy that is used by the KDE environment
itself as well as all KDE applications. In general KDE stores all its
+
itself as well as all KDE applications. In general, KDE stores all its
 
files in a fixed directory tree.
 
files in a fixed directory tree.
  
By default there are two such directory trees, one at the system
+
By default, there are two such directory trees: one at the system
 
level and one at the user level in the user's home directory. However,
 
level and one at the user level in the user's home directory. However,
 
as a system administrator you can create additional trees.
 
as a system administrator you can create additional trees.
  
KDE and KDE applications look up files by scanning the directory trees.
+
KDE and KDE applications look up files by scanning the directory trees
The directory trees are in order of precedence. When a file is
+
in order of precedence. When a file is
present in multiple directory trees, the file from the first listed
+
present in multiple directory trees, the file from the first-listed
tree takes precendence.
+
tree takes precedence.
 
Normally, the tree located in the user's home directory has the highest
 
Normally, the tree located in the user's home directory has the highest
precedence. This is also the directory tree where changes are
+
precedence. This is also the directory tree that changes are
 
written to.
 
written to.
  
For configuration files the story is slightly
+
For configuration files, the story is slightly
different. If there are multiple configuration files found in the directory
+
different. If multiple configuration files with the same name are found in the directory
trees with the same name their content is combined. The precedence order
+
trees, their content is combined. The precedence order
of the directory trees plays a role here. When two files define the same
+
of the directory trees plays a role here: when two files define the same
 
configuration key, the file with the highest precedence determines which
 
configuration key, the file with the highest precedence determines which
 
value is used for the key.
 
value is used for the key.
Line 28: Line 28:
 
environment variables, each of which is covered below.
 
environment variables, each of which is covered below.
  
=== $KDEHOME ===
+
=== KDEHOME ===
This environment variable determines the location of the user level
+
The <tt>KDEHOME</tt> environment variable determines the location of the user-level
 
directory tree and is used by KDE applications for creating and saving
 
directory tree and is used by KDE applications for creating and saving
 
files. This directory tree has the highest precedence; files or settings
 
files. This directory tree has the highest precedence; files or settings
found in this directory tree will take precendent over any files or settings
+
found in this directory tree will take precedence over any files or settings
 
found in other directory trees.
 
found in other directory trees.
  
This directory tree is, as the name already suggests, normally located in the home directory of the user. If this environment variable is not defined the default location $HOME/.kde is used.
+
This directory tree is, as the name suggests, normally located in the user's home directory. If this environment variable is not defined, the default location <tt>$HOME/.kde</tt> is used.
  
If the environment variable has a value that starts with a tilde (~), the tilde is replaced with the users home directory at runtime. In order to use this care must be taken to add proper quoting, otherwise the shell might do the expansion already resulting in undesired behaviour in combination with su.
+
If the environment variable has a value that starts with a tilde (~), the tilde is replaced with the user's home directory at runtime. In order to use this, care must be taken to add proper quoting, otherwise the shell might do the expansion, resulting in undesired behavior in combination with <tt>su</tt>.
  
=== $KDEROOTHOME ===
+
=== KDEROOTHOME ===
In order to prevent problems where applications that run as root save
+
In order to prevent problems with applications that run as root saving
files with root-privileges in the user's home directory, the $KDEROOTHOME
+
files with root access permissions in the user's home directory, the <tt>KDEROOTHOME</tt>
 
environment variable has been introduced in the KDE 3.x series. Applications
 
environment variable has been introduced in the KDE 3.x series. Applications
 
that run with uid 0 (root) will use this variable to determine the location of
 
that run with uid 0 (root) will use this variable to determine the location of
 
the user level directory and where to save their files. If this variable is
 
the user level directory and where to save their files. If this variable is
not defined the home directoy of the root user is looked up in the password
+
not defined, the root user's home directory is looked up in the password
file and .kde is appended. Usually that results in /root/.kde .
+
file and .kde is appended. Usually that results in <tt>/root/.kde</tt> .
  
=== $KDEDIRS ===
+
=== KDEDIRS ===
It is possible to specify multiple system level directory trees. This makes it possible to let groups of users use a directory tree dedicated for their group. Such an additional directory tree can contain additional applications, specialized application resources or a specific set of default configurations suitable for the group. Specifying default configurations this way instead of using a /etc/skel construction has as advantage that changes in the default configuration can be made after the account of the user has been created.
+
It is possible to specify multiple system-level directory trees. This allows groups of users to each dedicate a directory to their group. Such an additional directory tree can contain additional applications, specialized application resources or a specific set of default configurations suitable for the group. Specifying default configurations this way instead of using a /etc/skel construction has the advantage that changes in the default configuration can be made after the user's account has been created.
  
The directories in $KDEDIRS should be seperated with a colon (:). The directories are listed in precedence order, the first directory has highest precedence, the last one lowest precedence.
+
The directories in $KDEDIRS should be separated with a colon (:). The directories are listed in order of precedence: the first directory has the highest precedence, the last one has the lowest precedence.
  
Since a group level directory tree should normally override any settings present at the system level, one would list the group level directory tree before the system level directory tree.
+
Since a group-level directory tree should normally override any settings present at the system level, one should list the group-level directory tree before the system level directory tree.
  
 
In general communication, references to the directory trees are made in
 
In general communication, references to the directory trees are made in
terms of $KDEHOME to indicate the applicable user level directory tree,
+
terms of $KDEHOME to indicate the applicable user-level directory tree,
and in terms of $KDEDIRS to indicate any of the system level directory trees.
+
and in terms of $KDEDIRS to indicate any of the system-level directory trees.
  
 
==== Example ====
 
==== Example ====
Line 74: Line 74:
 
settings to /root/.kde3 . KDE 3 has been installed to /opt/kde3 but there is
 
settings to /root/.kde3 . KDE 3 has been installed to /opt/kde3 but there is
 
also an additional directory tree located at /opt/kde_staff . Configuration
 
also an additional directory tree located at /opt/kde_staff . Configuration
files under that directory will take precedent over the ones in the /opt/kde3
+
files under that directory will take precedence over the ones in the /opt/kde3
 
system directories. /opt/kde-staff could contain additional applications that
 
system directories. /opt/kde-staff could contain additional applications that
 
should only be available to staff members.
 
should only be available to staff members.
Line 81: Line 81:
 
== Directory Tree ==
 
== Directory Tree ==
  
Each directory tree used by KDE has a fixed directory structure. Directories
+
Each directory tree used by KDE has a fixed directory structure. However, directories
that are not relevant for a certain tree can be left out though. For example,
+
that are not relevant for a certain tree can be left out. For example,
 
directories used for temporary files are usually only found under $KDEHOME but
 
directories used for temporary files are usually only found under $KDEHOME but
 
not in any other directory tree.
 
not in any other directory tree.
  
  
The KDE runtime environment combines the sub-directories found under the
+
The KDE runtime environment combines the subdirectories found under the
 
various directory trees and refers to them as a single KDE resource. The
 
various directory trees and refers to them as a single KDE resource. The
 
KDE resource name is listed in the tables below.
 
KDE resource name is listed in the tables below.
  
  
There are three broad categories: files that are CPU/architecture
+
There are three broad categories: files that are
specific, files that are host specific and files that are not specific with
+
CPU/architecture-specific, files that are host-specific and files that are not specific with
regards to host, CPU or architecture.
+
regard to host, CPU or architecture.
  
CPU/architecture specific directories:
+
CPU/architecture-specific directories:
  
 
{|
 
{|
Line 104: Line 104:
 
| {{path|bin/}} || exe || Used for KDE executables.
 
| {{path|bin/}} || exe || Used for KDE executables.
 
|-
 
|-
| {{path|cgi-bin/}} || cgi || CGI scipts that can be used by the KDE Help Center
+
| {{path|cgi-bin/}} || cgi || CGI scipts that can be used by the KDE Help Center.
 
|-
 
|-
 
| {{path|lib/}} || lib || Used for KDE libraries.
 
| {{path|lib/}} || lib || Used for KDE libraries.
Line 111: Line 111:
 
|}
 
|}
  
The following are host specific directories. They are only available under
+
The following are host-specific directories. They are only available under
 
$KDEHOME and are normally symlinked to locations outside the $KDEHOME
 
$KDEHOME and are normally symlinked to locations outside the $KDEHOME
 
directory tree.
 
directory tree.
Line 118: Line 118:
 
! Directory !! KDE&nbsp;resource !! Description
 
! Directory !! KDE&nbsp;resource !! Description
 
|-
 
|-
| {{path|socket-&lt;HOSTNAME&gt;}} || socket || This directory contains communication sockets. The filesystem used by $KDEHOME may not be suitable for communication sockets. For that reason this directory is by default symlinked to another location.
+
| {{path|socket-&lt;HOSTNAME&gt;}} || socket || This directory contains communication sockets. The filesystem used by $KDEHOME may not be suitable for communication sockets. For that reason this directory is symlinked to another location by default.
 
|-
 
|-
| {{path|tmp-&lt;HOSTNAME&gt;}} || tmp || This directory is used for temporary files. The filesystem used by $KDEHOME may be on a network. For performance reasons this directory is therefor by default symlinked to another location which is more likely to be on a local filesystem.
+
| {{path|tmp-&lt;HOSTNAME&gt;}} || tmp || This directory is used for temporary files. The filesystem used by $KDEHOME may be on a network. For performance reasons, this directory is therefore symlinked by default to another location which is more likely to be on a local filesystem.
 
|-
 
|-
 
| {{path|cache-&lt;HOSTNAME&gt;}} || cache || New in KDE 3.2. This directory is used for cached information such as HTTP objects, formatted help pages and the system configuration cache (ksycoca).
 
| {{path|cache-&lt;HOSTNAME&gt;}} || cache || New in KDE 3.2. This directory is used for cached information such as HTTP objects, formatted help pages and the system configuration cache (ksycoca).
  
Since this is non-essential information this directory is by default
+
Since this is non-essential information, this directory is
sylinked to a location outside $KDEHOME to help making backups of other
+
symlinked to a location outside $KDEHOME by default, to make it easier
information easier and to make it easier to reclaim diskspace.
+
to make backups of other information and to reclaim diskspace.
 
|}
 
|}
  
The majority of directories involves data that is not CPU, architecture or
+
The majority of directories involves data that is not CPU-, architecture- or
host specific, all these directories are prefixed with {{path|share/}}:
+
host-specific. All these directories are prefixed with {{path|share/}}:
  
 
{|
 
{|
 
! Directory !! KDE&nbsp;resource !! Description
 
! Directory !! KDE&nbsp;resource !! Description
 
|-
 
|-
| {{path|share/applnk/}} || apps || Contains .desktop files describing the KDE-menu.
+
| {{path|share/applnk/}} || apps || Contains .desktop files describing the KDE menu.
 
|-
 
|-
| {{path|share/apps/}} || data || Contains applications specific data files. Each application has a sub-directory here for storing its files.
+
| {{path|share/apps/}} || data || Contains application-specific data files. Each application has a subdirectory here for storing its files.
 
|-
 
|-
| {{path|share/config/}} || config || Contains configuration files. Configuration files are normally named after the application they belong to followed by "rc". There are also files that are specific to a component and as such referenced by all applications that use that component. A special case is "kdeglobals", this file is read by all KDE applications.
+
| {{path|share/config/}} || config || Contains configuration files. Configuration files are normally named after the application they belong to followed by "rc". There are also files that are specific to a component and as such referenced by all applications that use that component. A special case is "kdeglobals": this file is read by all KDE applications.
 
|-
 
|-
 
| {{path|share/config/session/}} || - || This directory is used by session management and is normally only available under $KDEHOME. At the end of a session KDE applications store their state here. The file names start with the name of the application followed by a number. The session manager "ksmserver" stores references to these numbers when saving a session in "ksmserverrc".
 
| {{path|share/config/session/}} || - || This directory is used by session management and is normally only available under $KDEHOME. At the end of a session KDE applications store their state here. The file names start with the name of the application followed by a number. The session manager "ksmserver" stores references to these numbers when saving a session in "ksmserverrc".
Line 145: Line 145:
 
| {{path|share/doc/HTML/}} || html || Documentation of KDE applications is stored here. Documentation is categorized by language and the application it belongs to.  
 
| {{path|share/doc/HTML/}} || html || Documentation of KDE applications is stored here. Documentation is categorized by language and the application it belongs to.  
  
Normally at least two files can be found in a directory: "index.docbook" which contains the documentation in the unformatted docbook format and "index.cache.bz2" which contains the same documentation formatted as bzip2 compressed html. The html version is used by khelpcenter, if the html version is missing it will regenerate it from the docbook version but this is a time-consuming process.
+
Normally at least two files can be found in a directory: "index.docbook" which contains the documentation in the unformatted docbook format and "index.cache.bz2" which contains the same documentation formatted as bzip2 compressed html. The html version is used by khelpcenter; if the html version is missing, it will regenerate it from the docbook version, but this is a time-consuming process.
 
|-
 
|-
| {{path|share/icons/}} || icon || Under this directory icons are stored. Icons are categorized per theme, dimension and usage category.
+
| {{path|share/icons/}} || icon || Icons are stored under this directory, categorized by theme, dimension and usage category.
 
|-
 
|-
| {{path|share/mimelnk/}} || mime || In this directory .desktop files that describe mimetypes are stored.
+
| {{path|share/mimelnk/}} || mime || In this directory, .desktop files that describe MIME types are stored.
 
|-
 
|-
| {{path|share/services/}} || services || This directory contains .desktop files that describe services. Services and Applications are very similar, the major difference is that a Service is usually used by other Services or Applications while an Application is in general started by the user. Services do not appear in the KDE menu.
+
| {{path|share/services/}} || services || This directory contains .desktop files that describe services. Services and Applications are very similar; the major difference is that a Service is usually used by other Services or Applications while an Application is in general started by the user. Services do not appear in the KDE menu.
 
|-
 
|-
| {{path|share/servicetypes/}} || servicetypes || This directory contains .desktop files that describe servicetypes. A servicetype usually represents a certain programming interface. Applications and Services include in their .desktop files the servicetypes that they provide.
+
| {{path|share/servicetypes/}} || servicetypes || This directory contains .desktop files that describe service types. A service type usually represents a certain programming interface. Applications and Services include the servicetypes that they provide in their .desktop files.
 
|-
 
|-
 
| {{path|share/sounds/}} || sound || This directory contains sound files.
 
| {{path|share/sounds/}} || sound || This directory contains sound files.
 
|-
 
|-
| {{path|share/templates/}} || templates || This dir contains templates for creating files of various types. A template consists of a .desktop file that describes the file and that includes a reference to a file in the .source sub-directory. The templates in this directory appearem in the "Create New" menu available on the desktop and in the file browser. When a user selects a template from the menu its source file is copied.
+
| {{path|share/templates/}} || templates || This directory contains templates for creating files of various types. A template consists of a .desktop file that describes the file and that includes a reference to a file in the .source subdirectory. The templates in this directory appear in the "Create New" menu available on the desktop and in the file browser. When a user selects a template from the menu, its source file is copied.
 
|-
 
|-
| {{path|share/wallpapers/}} || wallpaper || This directory contains images that can be used as background picture.
+
| {{path|share/wallpapers/}} || wallpaper || This directory contains images that can be used as background pictures.
 
|}
 
|}
  
 
== Outside the Directory Tree ==
 
== Outside the Directory Tree ==
  
As mentioned in the description of the directory tree, there are three host-specific directories that are usually symlinked to other locations. If the directories do not already exist, the following symlinks and directories will be created using the lnusertemp utility. Since both /tmp and /var/tmp are world writable, there is a possibility that one of the mentioned directories already exists but is owned by another user. In that case the lnusertemp utility will create a new directory with an alternative name and link to that instead.
+
As mentioned in the description of the directory tree, there are three host-specific directories that are usually symlinked to other locations. If the directories do not already exist, the following symlinks and directories will be created using the <tt>lnusertemp</tt> utility. Since both <tt>/tmp</tt> and <tt>/var/tmp</tt> are world writable, there is a possibility that one of the mentioned directories already exists but is owned by another user. In that case the <tt>lnusertemp</tt> utility will create a new directory with an alternative name and link to that instead.
  
 
=== Sockets ===
 
=== Sockets ===
Line 171: Line 171:
 
Default destination: {{path|/tmp/ksocket-&lt;USER&gt;/}}
 
Default destination: {{path|/tmp/ksocket-&lt;USER&gt;/}}
  
<tt>lnusertemp&nbsp;socket</tt> creates a directory for local communication sockets and point a symlink to it. The combined length of the directory name and the name of any communication socket should not exceed 106 characters. By default this directory is created under /tmp, other locations can be used by setting the KDETMP environment variable.
+
<tt>lnusertemp&nbsp;socket</tt> creates a directory for local communication sockets and point a symlink to it. The combined length of the directory name and the name of any communication socket should not exceed 106 characters. By default this directory is created under <tt>/tmp</tt>, other locations can be used by setting the KDETMP environment variable.
  
 
=== Temporary Files ===
 
=== Temporary Files ===
Line 178: Line 178:
 
Default destination: {{path|/tmp/kde-&lt;USER&gt;/}}
 
Default destination: {{path|/tmp/kde-&lt;USER&gt;/}}
  
<tt>lnusertemp&nbsp;tmp</tt> creates a directory for temporary files and points a symlink to it. For performance reasons it is recommended to have this directory on a local filesystem but this is not strictly necassery.
+
<tt>lnusertemp&nbsp;tmp</tt> creates a directory for temporary files and points a symlink to it. For performance reasons it is recommended to have this directory on a local filesystem but this is not strictly necessary.
  
 
=== Cache Files ===
 
=== Cache Files ===
 
Symlink: {{path|$KDEHOME/cache-&lt;HOSTNAME&gt;}}
 
Symlink: {{path|$KDEHOME/cache-&lt;HOSTNAME&gt;}}
 
   
 
   
Defualt destination: {{path|/var/tmp/kdecache-&lt;USER&gt;/}}</code>
+
Default destination: {{path|/var/tmp/kdecache-&lt;USER&gt;/}}</code>
  
<tt>lnusertemp&nbsp;cache</tt> creates a directory for cache files and points a symlink to it. For performance reasons it is recommended to have this directory on a local filesystem but this is not strictly necassery.
+
<tt>lnusertemp&nbsp;cache</tt> creates a directory for cache files and points a symlink to it. For performance reasons it is recommended to have this directory on a local filesystem but this is not strictly necessary.
  
 
The system configuration cache (ksycoca and ksycocastamp) is located in here. It is recommended NOT to delete these files during boot since that will slow down the startup of KDE.
 
The system configuration cache (ksycoca and ksycocastamp) is located in here. It is recommended NOT to delete these files during boot since that will slow down the startup of KDE.
  
By default this directory is created under /var/tmp, other locations
+
By default this directory is created under <tt>/var/tmp</tt>, other locations
can be used by setting the $KDEVARTMP environment variable.
+
can be used by setting the KDEVARTMP environment variable.
  
 
== Adding Lookup Locations ==
 
== Adding Lookup Locations ==
Line 196: Line 196:
 
KDE applications look up data files using the resource names listed in the
 
KDE applications look up data files using the resource names listed in the
 
[#dir_structure Directory Tree] section.  The KDE runtime
 
[#dir_structure Directory Tree] section.  The KDE runtime
environment translates these names to actual directories. It does so
+
environment translates these names to actual directories
 
by combining the locations of the directory trees with the directories
 
by combining the locations of the directory trees with the directories
 
listed in the tables.
 
listed in the tables.
Line 209: Line 209:
 
</code>
 
</code>
  
When an application now looks for a "wallpaper" file, to each of the
+
When an application now looks for a "wallpaper" file, the directory "share/wallpapers/" is added to each of the
directory trees the directory "share/wallpapers/" is added. All of the
+
directory trees. All of the
 
resulting directories are then searched for the file:
 
resulting directories are then searched for the file:
  
Line 225: Line 225:
 
in the kdeglobals configuration file in the "Directories" section.
 
in the kdeglobals configuration file in the "Directories" section.
 
To do so assign one or more directories to the key "dir_" followed by the
 
To do so assign one or more directories to the key "dir_" followed by the
name of the resource. Multiple directories are seperated by a commas (,).
+
name of the resource. Multiple directories are separated by commas (,).
  
 
==== Adding a Resource Directory ====
 
==== Adding a Resource Directory ====
Line 244: Line 244:
 
~/.kde3/share/wallpapers/
 
~/.kde3/share/wallpapers/
 
/opt/kde_staff/share/wallpapers/
 
/opt/kde_staff/share/wallpapers/
/opt/kde3/share/wallpapers/</code>
+
/opt/kde3/share/wallpapers/
 +
</code>

Revision as of 00:46, 15 April 2007

Contents

Introduction

KDE defines a filesystem hierarchy that is used by the KDE environment itself as well as all KDE applications. In general, KDE stores all its files in a fixed directory tree.

By default, there are two such directory trees: one at the system level and one at the user level in the user's home directory. However, as a system administrator you can create additional trees.

KDE and KDE applications look up files by scanning the directory trees in order of precedence. When a file is present in multiple directory trees, the file from the first-listed tree takes precedence. Normally, the tree located in the user's home directory has the highest precedence. This is also the directory tree that changes are written to.

For configuration files, the story is slightly different. If multiple configuration files with the same name are found in the directory trees, their content is combined. The precedence order of the directory trees plays a role here: when two files define the same configuration key, the file with the highest precedence determines which value is used for the key.

Location of the Directory Trees

The location of the KDE Directory Trees is determined by a number of environment variables, each of which is covered below.

KDEHOME

The KDEHOME environment variable determines the location of the user-level directory tree and is used by KDE applications for creating and saving files. This directory tree has the highest precedence; files or settings found in this directory tree will take precedence over any files or settings found in other directory trees.

This directory tree is, as the name suggests, normally located in the user's home directory. If this environment variable is not defined, the default location $HOME/.kde is used.

If the environment variable has a value that starts with a tilde (~), the tilde is replaced with the user's home directory at runtime. In order to use this, care must be taken to add proper quoting, otherwise the shell might do the expansion, resulting in undesired behavior in combination with su.

KDEROOTHOME

In order to prevent problems with applications that run as root saving files with root access permissions in the user's home directory, the KDEROOTHOME environment variable has been introduced in the KDE 3.x series. Applications that run with uid 0 (root) will use this variable to determine the location of the user level directory and where to save their files. If this variable is not defined, the root user's home directory is looked up in the password file and .kde is appended. Usually that results in /root/.kde .

KDEDIRS

It is possible to specify multiple system-level directory trees. This allows groups of users to each dedicate a directory to their group. Such an additional directory tree can contain additional applications, specialized application resources or a specific set of default configurations suitable for the group. Specifying default configurations this way instead of using a /etc/skel construction has the advantage that changes in the default configuration can be made after the user's account has been created.

The directories in $KDEDIRS should be separated with a colon (:). The directories are listed in order of precedence: the first directory has the highest precedence, the last one has the lowest precedence.

Since a group-level directory tree should normally override any settings present at the system level, one should list the group-level directory tree before the system level directory tree.

In general communication, references to the directory trees are made in terms of $KDEHOME to indicate the applicable user-level directory tree, and in terms of $KDEDIRS to indicate any of the system-level directory trees.

Example

A staff member at a university could have the following settings:


KDEHOME='~/.kde3' KDEROOTHOME='/root/.kde3' KDEDIRS='/opt/kde_staff:/opt/kde3'

In this example the user settings are saved under the .kde3 directory in the user's home directory. Applications that run as root will save their settings to /root/.kde3 . KDE 3 has been installed to /opt/kde3 but there is also an additional directory tree located at /opt/kde_staff . Configuration files under that directory will take precedence over the ones in the /opt/kde3 system directories. /opt/kde-staff could contain additional applications that should only be available to staff members.


Directory Tree

Each directory tree used by KDE has a fixed directory structure. However, directories that are not relevant for a certain tree can be left out. For example, directories used for temporary files are usually only found under $KDEHOME but not in any other directory tree.


The KDE runtime environment combines the subdirectories found under the various directory trees and refers to them as a single KDE resource. The KDE resource name is listed in the tables below.


There are three broad categories: files that are CPU/architecture-specific, files that are host-specific and files that are not specific with regard to host, CPU or architecture.

CPU/architecture-specific directories:

Directory KDE resource Description
bin/ exe Used for KDE executables.
cgi-bin/ cgi CGI scipts that can be used by the KDE Help Center.
lib/ lib Used for KDE libraries.
lib/kde3/ module This directory contains components, plugins and other runtime loadable objects for use by KDE 3.x applications.

The following are host-specific directories. They are only available under $KDEHOME and are normally symlinked to locations outside the $KDEHOME directory tree.

Directory KDE resource Description
socket-<HOSTNAME> socket This directory contains communication sockets. The filesystem used by $KDEHOME may not be suitable for communication sockets. For that reason this directory is symlinked to another location by default.
tmp-<HOSTNAME> tmp This directory is used for temporary files. The filesystem used by $KDEHOME may be on a network. For performance reasons, this directory is therefore symlinked by default to another location which is more likely to be on a local filesystem.
cache-<HOSTNAME> cache New in KDE 3.2. This directory is used for cached information such as HTTP objects, formatted help pages and the system configuration cache (ksycoca).

Since this is non-essential information, this directory is symlinked to a location outside $KDEHOME by default, to make it easier to make backups of other information and to reclaim diskspace.

The majority of directories involves data that is not CPU-, architecture- or host-specific. All these directories are prefixed with share/:

Directory KDE resource Description
share/applnk/ apps Contains .desktop files describing the KDE menu.
share/apps/ data Contains application-specific data files. Each application has a subdirectory here for storing its files.
share/config/ config Contains configuration files. Configuration files are normally named after the application they belong to followed by "rc". There are also files that are specific to a component and as such referenced by all applications that use that component. A special case is "kdeglobals": this file is read by all KDE applications.
share/config/session/ - This directory is used by session management and is normally only available under $KDEHOME. At the end of a session KDE applications store their state here. The file names start with the name of the application followed by a number. The session manager "ksmserver" stores references to these numbers when saving a session in "ksmserverrc".
share/doc/HTML/ html Documentation of KDE applications is stored here. Documentation is categorized by language and the application it belongs to.

Normally at least two files can be found in a directory: "index.docbook" which contains the documentation in the unformatted docbook format and "index.cache.bz2" which contains the same documentation formatted as bzip2 compressed html. The html version is used by khelpcenter; if the html version is missing, it will regenerate it from the docbook version, but this is a time-consuming process.

share/icons/ icon Icons are stored under this directory, categorized by theme, dimension and usage category.
share/mimelnk/ mime In this directory, .desktop files that describe MIME types are stored.
share/services/ services This directory contains .desktop files that describe services. Services and Applications are very similar; the major difference is that a Service is usually used by other Services or Applications while an Application is in general started by the user. Services do not appear in the KDE menu.
share/servicetypes/ servicetypes This directory contains .desktop files that describe service types. A service type usually represents a certain programming interface. Applications and Services include the servicetypes that they provide in their .desktop files.
share/sounds/ sound This directory contains sound files.
share/templates/ templates This directory contains templates for creating files of various types. A template consists of a .desktop file that describes the file and that includes a reference to a file in the .source subdirectory. The templates in this directory appear in the "Create New" menu available on the desktop and in the file browser. When a user selects a template from the menu, its source file is copied.
share/wallpapers/ wallpaper This directory contains images that can be used as background pictures.

Outside the Directory Tree

As mentioned in the description of the directory tree, there are three host-specific directories that are usually symlinked to other locations. If the directories do not already exist, the following symlinks and directories will be created using the lnusertemp utility. Since both /tmp and /var/tmp are world writable, there is a possibility that one of the mentioned directories already exists but is owned by another user. In that case the lnusertemp utility will create a new directory with an alternative name and link to that instead.

Sockets

Symlink: $KDEHOME/socket-<HOSTNAME>

Default destination: /tmp/ksocket-<USER>/

lnusertemp socket creates a directory for local communication sockets and point a symlink to it. The combined length of the directory name and the name of any communication socket should not exceed 106 characters. By default this directory is created under /tmp, other locations can be used by setting the KDETMP environment variable.

Temporary Files

Symlink: $KDEHOME/tmp-<HOSTNAME>

Default destination: /tmp/kde-<USER>/

lnusertemp tmp creates a directory for temporary files and points a symlink to it. For performance reasons it is recommended to have this directory on a local filesystem but this is not strictly necessary.

Cache Files

Symlink: $KDEHOME/cache-<HOSTNAME>

Default destination: /var/tmp/kdecache-<USER>/</code>

lnusertemp cache creates a directory for cache files and points a symlink to it. For performance reasons it is recommended to have this directory on a local filesystem but this is not strictly necessary.

The system configuration cache (ksycoca and ksycocastamp) is located in here. It is recommended NOT to delete these files during boot since that will slow down the startup of KDE.

By default this directory is created under /var/tmp, other locations can be used by setting the KDEVARTMP environment variable.

Adding Lookup Locations

KDE applications look up data files using the resource names listed in the [#dir_structure Directory Tree] section. The KDE runtime environment translates these names to actual directories by combining the locations of the directory trees with the directories listed in the tables.

Defining Search Paths

A user has the following directory tree settings:

KDEHOME='~/.kde3' KDEDIRS='/opt/kde_staff:/opt/kde3'

When an application now looks for a "wallpaper" file, the directory "share/wallpapers/" is added to each of the directory trees. All of the resulting directories are then searched for the file:

~/.kde3/share/wallpapers/ /opt/kde_staff/share/wallpapers/ /opt/kde3/share/wallpapers/

By adding more directory tree to the KDEDIRS environment variable it is possible to expand the number of directories that are being searched. Sometimes it is desirable to include only a single directory in a search but not a whole directory tree. Additional directories can be configured in the kdeglobals configuration file in the "Directories" section. To do so assign one or more directories to the key "dir_" followed by the name of the resource. Multiple directories are separated by commas (,).

Adding a Resource Directory

To add the directory /data/photos to the wallpaper resource, put the following two lines in kdeglobals:

[Directories] dir_wallpaper=/data/photos

When the application now looks for wallpaper files, it will look in the following locations:

/data/photos ~/.kde3/share/wallpapers/ /opt/kde_staff/share/wallpapers/ /opt/kde3/share/wallpapers/


KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal