systemd-path
Show systemd search paths
TLDR
Display a list of known paths and their current values
Query the specified path and display its value
Suffix printed paths with suffix_string
Print a short version string and then exit
SYNOPSIS
systemd-path [PATHNAME]
systemd-path [OPTIONS...]
PARAMETERS
PATHNAME
(Optional) The specific symbolic name of the path to query. If omitted, all known systemd paths and their corresponding locations are listed. Examples include unit, system-unit, user-unit, config, data, run, journal, etc.
--help
Displays a brief help message and exits.
--version
Shows the systemd version string and exits.
DESCRIPTION
systemd-path is a utility included with the systemd system and service manager. Its primary purpose is to display the default installation and runtime paths used by systemd for various components. These paths include locations for systemd unit files (e.g., services, sockets, targets), configuration directories, state directories, library paths, and temporary file locations.
Administrators and developers can use systemd-path to programmatically query these locations, which is particularly useful for scripting, automating deployments, or debugging issues related to file placement. When invoked without arguments, it lists all known paths and their corresponding locations. If a specific PATHNAME is provided, it outputs only the path associated with that name, making it easy to find specific directories like where system-wide unit files (system-unit) or user-specific configuration files (user-config) are expected to reside. It provides a consistent way to determine systemd's file hierarchy based on its compilation and runtime environment.
CAVEATS
The paths reported by systemd-path represent the default or compiled-in locations. Actual operational paths might be overridden by system configurations (e.g., in /etc/systemd/system.conf), environment variables, or specific mount points. This command reflects where systemd expects to find files, not necessarily where a currently running service's files are loaded from if overrides are in place. It is only available on systems that utilize systemd.
PATH CATEGORIES
Systemd paths queried by systemd-path are typically categorized. For instance, unit refers to a general unit path, while system-unit and user-unit refer specifically to system-wide and user-specific unit file directories, respectively. Other categories include config (configuration files), data (variable state data), library (shared libraries), and run (runtime state data). Understanding these distinctions is crucial for placing custom configurations or units in the correct locations according to systemd's hierarchy.
USAGE SCENARIOS
This command is invaluable for scripting system administration tasks where knowing systemd's expected file locations is necessary. For example:
- To find the path for system-wide service units: systemd-path system-unit
- To list all known systemd paths: systemd-path
- To locate the system journal directory: systemd-path journal
HISTORY
systemd-path is an integral part of the systemd project, which was initially released in 2010. As systemd's scope and file hierarchy grew, a standardized and programmatic way to query its various installation and runtime directories became essential for robust scripting and system administration. systemd-path was introduced to fulfill this need, providing a reliable interface for developers and administrators to determine systemd's internal path conventions, improving consistency and automation capabilities across different systemd-based environments.