Categories: Ubuntu

How to use systemctl in Ubuntu

The systemctl command is the key management tool for init system control. We examine this command and discuss how services are managed, checked status, changed system statements, and configured files.

An init system has its basic objective to initialize components to be launched after the Linux kernel booting. This system is used to manage services and daemons at all times running in a touring machine.

The init is no longer the top of each process chain and is replaced by the systemd. The systemd is the initialization and management framework for a Linux operating system. systemd activity is structured by “units” that manage start/stop/restart, etc. Run levels are now substituted for objectives.

What is systemd?

Several Linux distributions control system settings and services using systemd.

systemd divides activities into units and unit groups into targets to establish dependencies on other system services and resources.

systemd can automatically boot the devices and targets, or if asked, the server already runs if a user or another systemd target.

What are systemd Unit Files?

In systemd, a unit corresponds to a single component. A text file describing a unit is termed a unit file. It describes what needs to be executed and what runs before and afterward, and other details. The systemd configures and manages system resources such as processes and your system files using unit files. Copy of the unit files in the system is typically stored in the following directory: /lib/systemd/system, which is the default location for the program to install unit files on the system.

What is the systemctl command?

The systemctl command utility interacts with systemd-controlled processes. It can look at and start, stop and change the state of units and objectives in your machine.

Starting and Stopping Services

The start command is used to perform instructions in the service unit file to start a systemd service. You may use sudo if you are a non-root user, as that affects the operating system status.

sudo systemctl start application.service

The command below stops currently running service:

sudo systemctl stop application.service

The command below restarts and reloads the service:

sudo systemctl restart application.service

Run the enable command to start a service at boot to tell systemd to start services automatically at boot; you must enable them.

sudo systemctl enable application.service

The command below is used to disable the service from starting automatically:

sudo systemctl disable application.service

The command below is used to check the status of a service on your system:

systemctl status application.service

Conclusion

To conclude, we discussed various techniques of managing our systemd services using the systemctl command in Ubuntu and examining and controlling the systemd system and service manager using various commands. systemctl is a robust, flexible, and easy-to-use command utility that allows us to monitor and interact to build, edit and delete unit files via the Service Manager. The command is used for multiple tasks like enabling, disabling, starting and stopping the services. The above examples reflect the importance of this command in managing our services on our machine.

Ubuntu Server Admin

Recent Posts

🚀 Deploy Elastic Stack on Ubuntu VPS (5 Minute Quick-Start Guide)

Here’s the guide to deploy Elastic Stack on Ubuntu VPS, with secure access, HTTPS proxying,…

1 day ago

🚀 Deploy Nagios on Ubuntu VPS

This guide walks through deploying Nagios Core on an Ubuntu VPS, from system prep to…

1 day ago

Shoryuken Has a New Maintainer, and v7.0.0 Is Almost There

After a decade under Pablo Cantero's stewardship, Shoryuken has a new maintainer - me. I'm…

5 days ago

A better way to provision NVIDIA BlueField DPUs at scale with MAAS

MAAS 3.7 has been officially released and it includes a bunch of cool new features.…

2 weeks ago

Ruby Floats: When 2.6x Faster Is Actually Slower (and Then Faster Again)

Update: This article originally concluded that Eisel-Lemire wasn't worth it for Ruby. I was wrong.…

2 weeks ago

MicroCeph: why it’s the superior MinIO alternative (and how to use it)

Recently, the team at MinIO moved the open source project into maintenance mode and will…

2 weeks ago