Systemd target units are used to group and manage services and other units in Linux distributions that use systemd as the init system. Targets are similar to runlevels in traditional SysVinit systems but offer more flexibility and granularity in defining system states and dependencies between units.
Here are some common systemd target units:
- default.target:
- This is the default target unit that the system boots into. It typically represents the normal operational state of the system.
- multi-user.target:
- Represents a multi-user system without a graphical interface. It includes services required for a text-based or command-line environment.
- graphical.target:
- Represents a multi-user system with a graphical interface (GUI). It includes services required for a graphical desktop environment.
- rescue.target:
- Similar to runlevel 1 or single-user mode in traditional SysVinit systems. It provides a minimal environment with a root shell for system recovery and maintenance tasks.
- emergency.target:
- Provides the most minimal environment possible, intended for emergencies where the system is in an unusable state. It drops the system into a single-user shell without starting any services.
- shutdown.target:
- Used to gracefully shut down the system. All services are stopped, and the system is powered off or rebooted, depending on the shutdown command used.
- poweroff.target:
- Initiates a system poweroff, shutting down the system and powering off the hardware.
- reboot.target:
- Initiates a system reboot, shutting down the system and restarting the hardware.
- network.target:
- Represents the network being available. Other services that depend on network connectivity may be started after this target is reached.
- basic.target:
- A minimal target that is reached early during the boot process. It includes basic system initialization and dependency handling.
- sockets.target:
- Represents the availability of system sockets. Services that provide network services via sockets may be started after this target is reached.
- timers.target:
- Represents the availability of system timers. Services that depend on timers for scheduling tasks may be started after this target is reached.
These are some of the common systemd target units used in Linux distributions. Depending on the specific distribution and configuration, there may be additional targets or custom targets defined. You can view the available targets on your system using the systemctl list-units --type=target command.