systemctl: Discover to Managing System Command Improve System Performance
2 mins read

systemctl: Discover to Managing System Command Improve System Performance

The systemctl command, An init system and system manager called systemd has gained widespread acceptance as the new norm for Linux distributions. Systemd is widely used, therefore taking the time to become familiar with it will pay off greatly in terms of server administration. You’ll be able to utilize systemd’s power, flexibility, and capabilities more effectively and efficiently if you understand and make use of its various tools and daemons.

Command which is the primary management tool for managing the init system, will be covered in this tutorial. We will go over how to work with configuration files, alter system states, check statuses, and manage services.

Understanding ‘systemctl’

In a Linux system that uses systemd, the command-line tool is used to manage and control units and services. It offers a single and simple method for controlling many system services, including as sockets, timers, daemons, and more. We can use command in programming as well. The following are some basic commands and how to use them:

Starting a Service

To start a service, use the following command:

sudo systemctl start service-name

Stopping a Service

To stop a service, use the following command:

sudo systemctl stop service-name

Enabling a Service at Boot

To ensure a service starts at boot, use:

sudo systemctl enable service-name

Disabling a Service at Boot

To prevent a service from starting at boot, use:

sudo systemctl disable service-name

Practical Examples

Starting and Stopping a Service

Suppose you want to start and stop the ‘apache2’ service (commonly used for the Apache web server):

sudo systemctl start apache2   # Start the Apache service
sudo systemctl stop apache2    # Stop the Apache service
systemctl start / stop apache2 server

Enabling and Disabling a Service at Boot

sudo systemctl enable ssh   # Enable SSH service at boot
sudo systemctl disable ssh  # Disable SSH service at boot

Checking Service Status

To check the status of the ‘mysql’ service, use:

systemctl status mysql
systemctl check status

systemctl‘ also provides advanced features like dependency management, controlling user services, and more. You can explore these capabilities further as you become more familiar with systemd.

On Linux systems, the powerful and adaptable command makes service management easier. System management becomes more efficient as a result of the streamlined process for initiating, halting, enabling, and disabling services. With a basic understanding of ‘systemctl‘ and some practice with real-world examples, you will be able to handle services in a systemd-based Linux environment with ease.

Share your Love