Systemctl Basics
The `systemctl` command is a central tool for controlling the **systemd** init system. It is used to manage services, check their status, and configure autostart.
Basic Operations
Start, Stop, and Restart a Service
sudo systemctl start [service_name]Starts a service.
sudo systemctl stop [service_name]Stops a service.
sudo systemctl restart [service_name]Restarts a service.
sudo systemctl reload [service_name]Reloads a service's configuration without a full restart.
Checking Status
Check the status of a service
systemctl status [service_name]Shows the detailed status of a service, including whether it is active, its PID, and recent log entries.
systemctl is-active [service_name]Checks if a service is currently running.
systemctl is-enabled [service_name]Checks if a service is configured to start automatically at boot.
Autostart (Enable/Disable)
Enable a service to start on boot
sudo systemctl enable [service_name]Enables a service, creating a symlink to ensure it starts automatically at boot.
Disable a service from starting on boot
sudo systemctl disable [service_name]Disables a service, removing the symlink that enables autostart.