Here is a list of some systemd target units along with examples of how to use them:
- multi-user.target:
- This target is used for a multi-user system without a graphical interface. It includes services required for a text-based or command-line environment.
- Example: To switch to the multi-user target, you can use the following command:
sudo systemctl isolate multi-user.target
- graphical.target:
- Represents a multi-user system with a graphical interface (GUI). It includes services required for a graphical desktop environment.
- Example: To switch to the graphical target, you can use the following command:sudo
systemctl isolate graphical.target
- 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.
- Example: To switch to the rescue target, you can use the following command:
sudo systemctl isolate rescue.target
- 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.
- Example: To switch to the emergency target, you can use the following command:
sudo systemctl emergency
- 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.
- Example: To initiate a shutdown using this target, you can use the following command:
sudo systemctl shutdown
- network.target:
- Represents the availability of the network. Other services that depend on network connectivity may be started after this target is reached.
- Example: To view the status of the network target, you can use the following command:
systemctl status network.target
- sockets.target:
- Represents the availability of system sockets. Services that provide network services via sockets may be started after this target is reached.
- Example: To view the status of the sockets target, you can use the following command:
systemctl status sockets.target
These are some of the systemd target units along with examples of how to use them. Depending on your specific distribution and configuration, there may be additional targets or custom targets defined. You can explore more targets and their usage by referring to the systemd documentation or using the systemctl list-units --type=target command.