Skip to main content

Systemctl

Systemctl is the command-line utility for controlling the systemd system and service manager.

Service Management

Start a Service

Starts a service immediately.

sudo systemctl start <service_name>

Example: sudo systemctl start caddy

Stop a Service

Stops a service immediately.

sudo systemctl stop <service_name>

Example: sudo systemctl stop pocketbase

Restart a Service

Restarts a service (stops and then starts it).

sudo systemctl restart <service_name>

Example: sudo systemctl restart sshd

Reload a Service

Reloads the configuration of a service without stopping it.

sudo systemctl reload <service_name>

Example: sudo systemctl reload apache2

Check Status

Checks the status of a service (active, failed, etc.).

sudo systemctl status <service_name>

Example: sudo systemctl status forgejo

Enable on Boot

Enables a service to start automatically at boot.

sudo systemctl enable <service_name>

Example: sudo systemctl enable gotosocial

Disable on Boot

Disables a service from starting automatically at boot.

sudo systemctl disable <service_name>

System Management

Daemon Reload

Reloads the systemd manager configuration. This is necessary if you have created or modified a service file.

sudo systemctl daemon-reload

Power Management

  • Reboot: sudo systemctl reboot or sudo reboot
  • Shutdown: sudo systemctl poweroff or sudo shutdown now