The latest version of Linux uses systemd(PID 1) rather than the init process. The command to control this systemd is systemctl.
Usasge | Description |
systemctl list-units | Print units with the active state. |
systemctl list-units --type service | Print service units with the active state. |
systemctl list-units --type service -a | Print service units with the active, inactive and not-found state. |
systemctl list-unit-files | Print whether the unit is enabled, disabled or static. |
systemctl status sshd | Print the status of sshd service. |
systemctl stop sshd | Stop the sshd service. |
systemctl start sshd | Start the sshd service |
systemctl restart sshd | Restart the sshd service |
systemctl disable sshd | Disable the sshd service. |
systemctl enable sshd | Enable the sshd service.
* Enable : When the system boots, It is executed automatically.
|
systemctl mask sshd | Set the mask for the sshd service.
* mask : A configuration that prevents the unit from execute.
|
systemctl unmask sshd | Remove the mask for the sshd service. |
systemctl reload sshd | Reload the mask for the sshd service. |
systemctl list-dependencies sshd | Print dependency of sshd service. |
systemctl get-default | Print default-target.
* Previous Linux's runlevel has been changed to target.
* See /etc/inittab for details.
|
systemctl set-default [Target] | Change the default-target.
* Target : multi-user.target(CLI) graphical.target(GUI)
|
systemctl isolate [Target] | Change current target. |