systemctl-get-default
Get default systemd boot target
TLDR
Check the default target on your system
SYNOPSIS
`systemctl [OPTIONS...] get-default`
PARAMETERS
`--user`
Operate on the user manager instance. This allows querying the default target for the calling user, instead of the system-wide default.
`--system`
Operate on the system manager instance. This is the default behavior and explicitly specifies that the system-wide default target should be retrieved.
`--no-pager`
Do not pipe output into a pager. Useful for scripting or when you want the output directly in the terminal without pagination.
`--json`
Format output as JSON. This option provides machine-readable output, which is beneficial for automation and parsing by other tools.
`--plain`
Print output as plain text, no headers or footers. Used for simpler output, often combined with `--value`.
`--value`
When used with `--plain`, print only values without keys. This produces a very concise output, showing just the target name, e.g., 'graphical.target'.
DESCRIPTION
The `systemctl get-default` command is a fundamental `systemd` utility used to retrieve and display the name of the default target unit that the system will boot into. In `systemd`, targets are special unit files that group other units and serve similar purposes to runlevels in traditional SysVinit systems.
Common default targets include `multi-user.target`, which provides a text-based, multi-user system without a graphical interface, and `graphical.target`, which enables all services of `multi-user.target` plus a graphical login manager. This command essentially shows the symbolic link from `/etc/systemd/system/default.target` to its actual target file, indicating the intended boot environment. It's a quick way for administrators to verify the system's configured boot mode without digging into configuration files.
Understanding the default target is crucial for system administration, troubleshooting boot issues, or customizing the boot process, ensuring the system starts in the desired state for its intended use.
CAVEATS
The output of `systemctl get-default` only shows the *configured* default target. If a specific target is temporarily overridden at boot time (e.g., via kernel command line `systemd.unit=rescue.target`), this command will still show the persistent default, not the target actually used for the current boot session.
Furthermore, this command does not provide information about the currently *active* target. To see the currently active target, commands like `systemctl status default.target` (which usually points to the active target) or `systemctl list-units --type target` can be used to inspect active target units.
SYMBOLIC LINK
The default target is typically established as a symbolic link, `/etc/systemd/system/default.target`, which points to the actual target unit file (e.g., `/usr/lib/systemd/system/graphical.target` or `/usr/lib/systemd/system/multi-user.target`). The `systemctl get-default` command simply resolves and displays the name of the target pointed to by this link.
OVERRIDING DEFAULTS
While `get-default` shows the persistently configured default, the boot target can be temporarily overridden at kernel boot time. This is done by appending `systemd.unit=your-target.target` to the kernel command line during boot (e.g., from the GRUB menu). This temporary override does not change the persistent default returned by `systemctl get-default`.
HISTORY
The `get-default` command is an integral part of `systemd`, which was initially developed by Lennart Poettering and Kay Sievers at Red Hat to replace the traditional SysVinit daemon for Linux operating systems. First introduced in Fedora 15 in 2011, `systemd` rapidly gained adoption across major Linux distributions due to its faster boot times, parallelization capabilities, and unified service management.
The concept of "targets" replaced "runlevels" in this new architecture, and commands like `get-default` and `set-default` were introduced to manage the system's boot behavior within this new framework. Its design brought a more consistent and robust approach to system initialization and service management on Linux, making `get-default` a standard tool for querying boot configuration.


