I
- Intro
Continuing from the previous post about GNU/Linux system startup, this time I’ll tell you about services.
How many times did I struggle with the “print spooler” service in Windows! If you worked in IT starting in Help Desk, Service Desk, or similar positions in corporate environments… you’ve suffered through it too -_-
As for Linux… well, the concept is similar but of course it has its differences.
Warning! If you keep reading, you’ll keep learning ;)
Services, Systemd, Systemctl, Sysvinit? Let’s go!
II
/sbin/init
Once the real filesystem is mounted, the kernel executes the binary located at /sbin/init
(typically nowadays it’s a link to systemd
), this /sbin/init
process will always have ID=1
. It’s the first user process of the system and initiates other subprocesses.
The init
process determines and launches the services and processes needed to complete system boot. Traditionally, System V Unix
(SysVinit
) was used. It had different runlevels
where each contained sets of scripts to start and stop services. Its modern contemporary counterpart systemd
has backward compatibility in this regard and supports runlevels
through runlevel targets
. It emulates the telinit
program to work with runlevels
, so if you’re reading this from any GNU/Linux distro with systemd
, you can try them to feed your curiosity:
Most non-kernel
processes in the OS have their root in this process, except those processes initiated directly by the Kernel to handle internal Kernel details.
init
is responsible for keeping the system running and shutting it down cleanly, and also for managing login
services when users connect and disconnect.
The init
can vary depending on the Linux version and distro, as I mentioned before, the most modern and widely used today is systemd
.
It’s possible to run another init
by specifying it in the system configuration or from the bootloader
.
How to know which init
I’m using? With the following command. Notice that /usr/sbin/init
points to systemd
.
ls -l $(which init)
proyectoleeti@fedora42:~$ ls -l $(which init)
lrwxrwxrwx. 1 root root 22 sep 6 21:00 /usr/sbin/init -> ../lib/systemd/systemd
III
Services
A service is a program or process that runs in the background (like a daemon
).
The systemd
init
is more modern than SysVinit
and is the most widely used currently. It’s responsible for loading and starting processes as well as starting and stopping services during OS execution proper. Some examples:
Apache web server httpd
.
Managing printers with CUPS cupsd
.
It’s common to manage a service through the systemctl
command, for example, to enable or disable services at OS startup:
-
systemctl enable httpd
-
systemctl disable httpd
To start or stop it:
-
systemctl start httpd
-
systemctl stop httpd
IV
Systemd
Systemd
uses .service
files unlike SysVinit
which uses bash scripts.
systemd
characteristics:
-
Organizes all
daemons
in their owncgroups
(control groups), contributing to better process traceability. -
Boots faster than previous
init
systems. -
Has a focus on parallelization.
-
Uses
socket
andD-Bus
activations to start services. -
Offers on-demand daemon startup.
-
Maintains mount points and automounting.
-
Can replace
SysVinit
without losing compatibility with its scripts. -
Compatibility with
SysVinit
commands.
Reviewing official documentation is always considered a good practice and is a tool that’s less valued every day (compared to “googling” and asking AI). For example, Fedora’s official documentation provides a command equivalence table between SystemD and SysVinit and much more:
-
SysVinit to Systemd
Fedora cheatsheet -
Systemd
Understanding and administering systemd :: Fedora Docs
Example of coexistence with SysVinit
commands even on a system with Systemd
, on Fedora 42
:
Notice that the same action is executable with systemctl
(systemd
) and with service
(sysVinit
), first to check the service status with sshd
and then to start/stop it with start
and stop
:
systemctl status sshd
proyectoleeti@fedora42:~$ systemctl status sshd
○ sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: inactive (dead)
Docs: man:sshd(8)
man:sshd_config(5)
sudo systemctl start sshd
systemctl status sshd
proyectoleeti@fedora42:~$ sudo systemctl start sshd
proyectoleeti@fedora42:~$ systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: active (running) since Mon 2025-09-15 12:04:20 CEST; 4s ago
Invocation: 5d416aa670044ec4a863c36ee1fb69d3
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 40530 (sshd)
Tasks: 1 (limit: 15357)
Memory: 1M (peak: 1.5M)
CPU: 17ms
CGroup: /system.slice/sshd.service
└─40530 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
sudo service sshd stop
systemctl status sshd
service sshd status
proyectoleeti@fedora42:~$ sudo service sshd stop
Redirecting to /bin/systemctl stop sshd.service
proyectoleeti@fedora42:~$ systemctl status sshd
○ sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: inactive (dead)
Docs: man:sshd(8)
man:sshd_config(5)
proyectoleeti@fedora42:~$ service sshd status
Redirecting to /bin/systemctl status sshd.service
○ sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: inactive (dead)
Docs: man:sshd(8)
man:sshd_config(5)
V
systemctl
System Control
or systemctl
is a command to manage units
.
A unit
is a configuration file that tells systemd
how to manage a system resource. It describes how to start, stop, reload, or monitor a system component.
These files are usually located in /etc/systemd/system
or /usr/lib/systemd/system
.
They represent a system task or component, among others: Services
, Timers
, Sockets
, Mounts
, etc. The most common are services and sockets:
-
A
.service
is a traditional service that runs in the background, likesshd
,bluetooth
, etc. -
A
socket
defines a network or UNIX socket. For example, anetwork socket
(ip + port).
Systemd can listen on that socket and only when there’s a connection, start the associated service. Useful for saving system resources. This is called socket activation
.
Some commands require sudo
(elevated user privileges), others don’t, depending on the scope.
The command structure is as follows:
systemctl [options] command [name]
Here are some very common day-to-day command examples.
-
See the status of all processes controlled by
systemd
:-
systemctl
-
-
Show all available services:
-
systemctl list-units -t service -all
-
-
List only active services:
-
systemctl list-units -t service
-
-
Various ways to start a service:
-
systemctl start bluetooth
-
systemctl start bluetooth.service
-
systemctl start /usr/lib/systemd/system/bluetooth.service
-
-
To stop it:
-
systemctl stop bluetooth
-
-
To enable/disable a service at system boot:
-
systemctl enable sshd.service
-
systemctl disable sshd.service
-
See some of the commands in action, this time in an Ubuntu 22.04 environment:
🐧 You’ve noticed that this post contains more command content than the previous one. It’s not an accident: in the next one we’ll complement with a hands-on
, that is, a lab
to practice everything on your own system.
Until the next post! 🐧