systemctl Command: Start, Stop, and Check Linux Services

Aidin

Toggle switch illustration for a systemctl guide

Hi everyone. Many programs on Linux are not apps you open from a menu but services that run quietly in the background, such as the printing system, the time sync, or a web server. On Ubuntu these services are managed by systemd, and the command you use to talk to it is systemctl. In this guide I use systemctl on Ubuntu 26.04 to check a service, stop and start it, and control whether it starts at boot.

For the practice I picked cups, the printing service that comes with Ubuntu Desktop. It is safe to stop for a minute, and it showed two behaviors that most systemctl guides do not mention, a warning that asks for daemon-reload and a service that keeps running after it is disabled.

If you have not read it yet, the previous article on the nano editor is useful here, because changing how a service behaves usually starts with editing its configuration file.

Distro  : Ubuntu 26.04.1 LTS (Desktop)
Service : cups (CUPS Scheduler, printing)

Checking a Service with systemctl status

Before changing anything, it is worth knowing what state a service is in. A service can be loaded but stopped, running but not set to start at boot, or not installed at all, and each case needs a different command to fix.

systemctl status answers all of that in one screen. It also does not need sudo, so it is safe to run as often as you like while you learn.

systemctl status

systemctl status cups with the daemon-reload warning
systemctl status cups --no-pager | head -n 12

I added –no-pager so the output prints straight to the terminal instead of opening a scrollable viewer, and head keeps it short. The first thing I got was a yellow warning that the unit file changed on disk and that I should run systemctl daemon-reload (number 1). This happens after a package update replaces a service file while the system is running.

The Loaded line shows where the service file lives and that it is enabled, which means it starts at boot (number 2). Active shows active (running) and how long it has been up (number 3). TriggeredBy lists cups.path and cups.socket, two helper units that can wake cups up on demand (number 4). Main PID is the process ID of the running program, cupsd (number 5).

systemctl daemon-reload

Running systemctl daemon-reload
sudo systemctl daemon-reload
systemctl status cups --no-pager | head -n 3

daemon-reload tells systemd to read the service files again (number 1). It does not restart any service, so it is safe to run. When I checked the status again, the warning was gone and cups was still running (number 2).

Stopping and Starting a Service

Stopping a service ends its process right away, and starting it runs it again. You do this when you want to apply a new configuration, free up a port, or test whether a problem disappears without the service.

Both commands change the system, so they need sudo. They also print nothing when they succeed, so it is a good habit to check the result with is-active afterwards.

systemctl stop

cups inactive after systemctl stop
sudo systemctl stop cups
systemctl is-active cups
systemctl status cups --no-pager | head -n 3

After the stop, is-active answers inactive (number 1). The status line now shows inactive (dead) together with the time it stopped (number 2). Notice that Loaded still says enabled. Stopping a service does not change whether it starts at the next boot.

systemctl start

Starting cups again with systemctl start
sudo systemctl start cups
systemctl is-active cups

start brings the service back, and is-active confirms active (number 1). If you want a stop and start in one step, for example after editing a config file, use sudo systemctl restart cups.

Enabling and Disabling at Boot

Enable and disable are about the future, not the present. They decide whether a service starts automatically the next time the computer boots, and they do this by creating or removing links in /etc/systemd/system.

This is where many beginners get confused, because disable does not stop a service that is already running, and enable does not start it unless you ask. The next two steps show both.

systemctl disable

systemctl disable cups with the cups.socket warning
sudo systemctl disable cups

systemctl lists every link it removed (number 1). Then it printed a yellow warning that cups.service was disabled but its triggering unit cups.socket is still active (number 2). In other words, anything that connects to the printing socket can still wake cups up.

Disabled but still running

Service disabled but still active
systemctl is-enabled cups
systemctl is-active cups

is-enabled now says disabled (number 1), but is-active still says active (number 2). Disable only affects the next boot. To turn a service off now and at boot, run sudo systemctl disable –now cups. For a service with sockets like cups, you would also stop cups.socket.

systemctl enable –now

systemctl enable --now cups
sudo systemctl enable --now cups
systemctl is-enabled cups
systemctl is-active cups

enable –now does both jobs at once, enabling the service at boot and starting it now (number 1). The output lists each link it created, including the ones for cups.socket and cups.path (number 2).

cups enabled and active again

The checks confirm enabled (number 1) and active (number 2), which is exactly how cups was set up before I started.

Finding the Right Service Name

systemctl needs the exact unit name, and a small typo gives an error that looks scarier than it is. When you are not sure what a service is called, it is faster to list what is running than to guess.

The list also helps you learn which background services a normal Ubuntu desktop runs, which is useful later when you need to troubleshoot.

Typo and list-units

Unit not found error and the list of running services
systemctl status cup
systemctl list-units --type=service --state=running --no-pager | head -n 8

A missing letter gives Unit cup.service could not be found (number 1). list-units with –type=service and –state=running shows every running service with a short description, and cups.service is in the list under its full name (number 2).

Common Problems and How to Fix Them

Most systemctl errors come from three causes: a missing sudo, a wrong unit name, or a service file that changed. The messages are short, so here is what each one means.

If a service keeps failing to start, systemctl status shows the last few log lines at the bottom, and that is the first place to look.

Interactive authentication required

You ran start, stop, enable, or disable without sudo. Run the same command again with sudo.

Unit could not be found

The name is wrong or the package is not installed. Check the name with systemctl list-units –type=service.

Warning: the unit file changed on disk

A package update replaced the service file. Run sudo systemctl daemon-reload.

The service still runs after disable

Disable only affects boot. Use disable –now, and stop its socket unit too if it has one.

That covers the systemctl commands you will use most: status, daemon-reload, stop, start, restart, enable, disable, and list-units. Next in the series is stopping processes that hang, with ps, kill, and pkill. If systemctl shows a message I did not cover, paste it in the comments.

Leave a Comment