Systemctl is a controller or utility of Systemd(is an init system with compost for a set of programs executed in the background), with auxiliary in manage services, these commands are executed in mode root if you aren’t mode root the system, requesting the password of root.
1. List all services:
systemctl list-unit-files --type service -all
2. Command Start:
sudo systemctl start service.service
The command start serves for starting (activate) one or more units specified on the command line.
sudo systemctl start mariadb
3. Command Stop:
sudo systemctl stop service.service
The command stop serves for stopping the service or (deactivate) one or more units specified on the command line.
sudo systemctl stop mariadb
4. Command Status:
sudo systemctl status service.service
The command status serves to check the status of the service. Show terse runtime status information about one or more units, followed by the most recent log data from the journal. If no units are specified, show system status.
sudo systemctl status mariadb
5. Command Restart:
sudo systemctl restart service.service
The command restart serves for restarting the service in execution. Stop and then start one or more units specified on the command line. If the units are not running yet, they will be started.
sudo systemctl restart mariadb
6. Command Enable:
sudo systemctl enable name_service.service
The enable command serves for executing the service since the initialization if consists of one or more units or unit instances. This will create a set of symlinks, as encoded in the [Install] sections of the indicated unit files. the system manager configuration is reloaded (in a way equivalent to daemon-reload), in order to ensure the changes are taken into account immediately.
sudo systemctl enable mariadb
7. Command Disable:
sudo systemctl disable name_service.service
The disable command serves for withdrawing the service since the initialization of one or more units. This removes all symlinks to the unit files backing the specified units from the unit configuration directory and hence undoes any changes made by enabling or link.
sudo systemctl disable mariadb
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.