Introduction
In this post we will be discussing on the systemctl command with the help of which we can manage systemd services and units. We will cover how to manage services, units , check status , change system states.
Managing services
To start the service using systemctl use bellow command
~]# systemctl start name.service
For checking the status of the service:
~]# systemctl status name.service
For stopping service using systemctl :
~]# systemctl stop name.service
To enabled services after reboot too:
systemctl enabled name.service
To check whether service is enable for reboot or not
systemctl is-enabled name.service
To determine what services are ordered to start before a service
~]# systemctl list-dependencies --before name.service
To determine what services are ordered to start after a service
~]# systemctl list-dependencies --after name.service
To disabled service from being automatically started at boot
systemctl disable name.service
Managing systemd units
To list all currently loaded service units :
systemctl list-units --type service
By default it loads only active service to list all units:
systemctl list-units --type service --all
To list all currently loaded service units to see if they are enabled:
systemctl list-unit-files --type service
Displaying Unit files:
systemctl cat name.service
Checking unit properties:
systemctl show name.service
Bellow command will prevent the service to start automatically or manually
systemctl mask name.service
Getting default target:
systemctl get-default
Setting default target:
systemctl set-default graphical.target
To isolate the target:
systemctl isolate multi-user.target
Comments
Post a Comment