Ubuntu Services
Systemctl Command
systemctl is used to introspect and control the state of the
systemd system and service manager in Ubuntu
systemctl [command] [service_name]
: command is an action you want to perform for service (start, stop, restart, etc).
: service_name is where you enter the name of the service to perform actions.
systemctl works with the initialization system files found in /lib/systemd
Command Usage
systemctl list-unit-files List all installed unit files and their states.
systemctl list-units –type=service –state=running Show a complete list of running services.
systemctl list-units –type=service –state=failed Show failed service
systemctl start [service] Start a service.
systemctl stop [service] Stop a service.
systemctl enable [service] Enable a service to start automatically at system boot.
systemctl disable [service] Disable a service from starting automatically at system boot.
systemctl status [service] View the status of a service.
systemctl restart [service] Restart a service.
systemctl reload [service] Reload a service’s configuration without restarting it.
systemctl mask [service] Prevent a service from being started.
systemctl unmask [service] Allow a previously masked service to be started.
systemctl set-default [target] Change the default system target (runlevel).
systemctl list-dependencies [unit] List the dependencies of a specific unit.
systemctl list-sockets List all active sockets.
systemctl list-jobs List all active systemd jobs.
systemctl list-units Show the status of all loaded and active systemd units.
systemctl daemon-reload reload all unit files, and recreate the entire dependency tree.