Systemctl

All active service

systemctl list-units --type=service --state=active

All running service

systemctl list-units --type=service --state=running

Specifiers available in unit files

Specifier

Meaning

Details

"%a"

Architecture

A short string identifying the architecture of the local system. A string such as x86, x86-64 or arm64. See the architectures defined for ConditionArchitecture= above for a full list.

"%b"

Boot ID

The boot ID of the running system, formatted as string. See random(4) for more information.

"%B"

Operating system build ID

The operating system build identifier of the running system, as read from the BUILD_ID= field of /etc/os-release. If not set, resolves to an empty string. See os-release(5) for more information.

"%C"

Cache directory root

This is either /var/cache (for the system manager) or the path "$XDG_CACHE_HOME" resolves to (for user managers).

"%E"

Configuration directory root

This is either /etc/ (for the system manager) or the path "$XDG_CONFIG_HOME" resolves to (for user managers).

"%f"

Unescaped filename

This is either the unescaped instance name (if applicable) with / prepended (if applicable), or the unescaped prefix name prepended with /. This implements unescaping according to the rules for escaping absolute file system paths discussed above.

"%g"

User group

This is the name of the group running the service manager instance. In case of the system manager this resolves to "root".

"%G"

User GID

This is the numeric GID of the user running the service manager instance. In case of the system manager this resolves to "0".

"%h"

User home directory

This is the home directory of the user running the service manager instance. In case of the system manager this resolves to "/root". Note that this setting is not influenced by the User= setting configurable in the [Service] section of the service unit.

"%H"

Host name

The hostname of the running system at the point in time the unit configuration is loaded.

"%i"

Instance name

For instantiated units this is the string between the first "@" character and the type suffix. Empty for non-instantiated units.

"%I"

Unescaped instance name

Same as "%i", but with escaping undone.

"%j"

Final component of the prefix

This is the string between the last "-" and the end of the prefix name. If there is no "-", this is the same as "%p".

"%J"

Unescaped final component of the prefix

Same as "%j", but with escaping undone.

"%l"

Short host name

The hostname of the running system at the point in time the unit configuration is loaded, truncated at the first dot to remove any domain component.

"%L"

Log directory root

This is either /var/log (for the system manager) or the path "$XDG_CONFIG_HOME" resolves to with /log appended (for user managers).

"%m"

Machine ID

The machine ID of the running system, formatted as string. See machine-id(5) for more information.

"%n"

Full unit name

"%N"

Full unit name

Same as "%n", but with the type suffix removed.

"%o"

Operating system ID

The operating system identifier of the running system, as read from the ID= field of /etc/os-release. See os-release(5) for more information.

"%p"

Prefix name

For instantiated units, this refers to the string before the first "@" character of the unit name. For non-instantiated units, same as "%N".

"%P"

Unescaped prefix name

Same as "%p", but with escaping undone.

"%s"

User shell

This is the shell of the user running the service manager instance. In case of the system manager this resolves to "/bin/sh".

"%S"

State directory root

This is either /var/lib (for the system manager) or the path "$XDG_CONFIG_HOME" resolves to (for user managers).

"%t"

Runtime directory root

This is either /run/ (for the system manager) or the path "$XDG_RUNTIME_DIR" resolves to (for user managers).

"%T"

Directory for temporary files

This is either /tmp or the path "$TMPDIR", "$TEMP" or "$TMP" are set to. (Note that the directory may be specified without a trailing slash.)

"%u"

User name

This is the name of the user running the service manager instance. In case of the system manager this resolves to "root". Note that this setting is not influenced by the User= setting configurable in the [Service] section of the service unit.

"%U"

User UID

This is the numeric UID of the user running the service manager instance. In case of the system manager this resolves to "0". Note that this setting is not influenced by the User= setting configurable in the [Service] section of the service unit.

"%v"

Kernel release

Identical to uname -r output.

"%V"

Directory for larger and persistent temporary files

This is either /var/tmp or the path "$TMPDIR", "$TEMP" or "$TMP" are set to. (Note that the directory may be specified without a trailing slash.)

"%w"

Operating system version ID

The operating system version identifier of the running system, as read from the VERSION_ID= field of /etc/os-release. If not set, resolves to an empty string. See os-release(5) for more information.

"%W"

Operating system variant ID

The operating system variant identifier of the running system, as read from the VARIANT_ID= field of /etc/os-release. If not set, resolves to an empty string. See os-release(5) for more information.

"%%"

Single percent sign

Use "%%" in place of "%" to specify a single percent sign.

https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers

Last updated