Welcome to today's session. In this module, we'll focus on how to identify automatically started system processes, how to control services using systemd, and you'll have hands-on exercises to reinforce your learning. We'll wrap up with a summary, additional resources, and a graded lab.
After completing the work in this module you will be able to:
systemctl
.systemctl
.By the end of this module, you will be able to identify active services on a system, determine their startup behavior, and use systemctl
to start, stop, restart, enable, disable, and manage services. This knowledge is essential for daily Linux system administration tasks.
When a Linux system boots up, a number of processes are started automatically. These are typically daemons, or background services. Knowing which services are started by default is critical for system performance and security.
Introduction to the systemd Daemon Systemd is the system and service manager for Red Hat Enterprise Linux systems. It starts with PID 1 and is responsible for initializing the system and managing services. Systemd improves performance through parallel service startup, supports on-demand service activation, and uses cgroups for process tracking.
Welcome to today's session. In this module, we'll focus on how to identify automatically started system processes, how to control services using systemd, and you'll have hands-on exercises to reinforce your learning. We'll wrap up with a summary, additional resources, and a graded lab.
[root@host ~]# systemctl list-units --type=service UNIT LOAD ACTIVE SUB DESCRIPTION atd.service loaded active running Job spooling tools auditd.service loaded active running Security Auditing chronyd.service loaded active running NTP client/server
Use the command systemctl list-units --type=service
to display all active services. This command shows which services are loaded, their current status, and a brief description. This is a good first step in auditing what is running on your system.
[root@host ~]# systemctl status sshd.service sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled) Active: active) since Mon 2022-03-14 05:38:12 EDT; 25min ago Docs: man:sshd(8) man:sshd_config(5) Main PID: 1114 (sshd) Tasks: 1 (limit: 35578) Memory: 5.2M CPU: 64ms CGroup: /system.slice/sshd.service └─1114 "sshd: /usr/sbin/sshd -D [listener]"
To inspect a specific service, use systemctl status
, followed by the service name. This gives detailed information, including whether the service is loaded and enabled, its current state, and its recent log output.
[root@host ~]# systemctl is-active sshd.service active
[root@host ~]# systemctl is-enabled sshd.service enabled
systemctl is-active
tells you whether a service is currently running. systemctl is-enabled
tells you whether the service is set to start at boot. These commands are especially useful in scripting or diagnostics.
In this exercise, you'll list all service units and identify which ones are currently running and which are enabled to start at boot. Use both systemctl list-units
and systemctl list-unit-files
to complete the task.
Now that we can identify services, let’s move on to controlling them. We’ll learn how to start, stop, restart, reload, mask, and enable services.
[root@host ~]# systemctl start sshd
[root@host ~]# systemctl stop sshd.service
To start a service manually, use systemctl start
followed by the service name. To stop it, use systemctl stop
. For example, systemctl start sshd
will start the SSH daemon, while systemctl stop sshd
will stop it. Remember, these actions affect the current session only, not the service’s startup behavior on boot.
[root@host ~]# systemctl restart sshd
[root@host ~]# systemctl reload sshd.service
Use systemctl restart
to stop and then start a service—this is useful when configuration files have changed. systemctl reload
tells the service to reload its configuration without stopping, if supported. Reload is less disruptive and preferred when available.
[root@host ~]# systemctl list-dependencies sshd.service sshd.service ├─system.slice ├─sshd-keygen.target │ ├─sshd-keygen@ecdsa.service │ ├─sshd-keygen@ed25519.service │ └─sshd-keygen@rsa.service └─sysinit.target
Every service may depend on others. To see what a unit depends on, use systemctl list-dependencies
. This reveals which targets and services are linked, helping you understand system boot order and troubleshoot service failures.
[root@host ~]# systemctl mask sendmail.service Created symlink /etc/systemd/system/sendmail.service → /dev/null
[root@host ~]# systemctl start sendmail.service Failed to start sendmail.service: sendmail.service is masked.
Masking a service makes it completely unstartable, even manually. This is done with systemctl mask
. It creates a symbolic link to /dev/null
. To allow the service to start again, use systemctl unmask
.
[root@servera ~]# systemctl enable sshd.service Created symlink /etc/systemd/.../sshd.service → /usr/lib/systemd/.../sshd.service.
[root@servera ~]# systemctl enable --now sshd.service Created symlink /etc/systemd/.../sshd.service → /usr/lib/systemd/.../sshd.service.
systemctl enable
allows a service to start automatically at boot. You can also use systemctl enable --now
to both enable and start the service. To prevent a service from starting at boot, use systemctl disable
.
Let’s summarize key systemctl
commands: use start
, stop
, restart
, and reload
to control services in the current session. Use enable
, disable
, mask
, and unmask
to manage their boot-time behavior. Use status
, is-active
, and is-enabled
to check service states.
Now it’s your turn to practice. Start and stop services like sshd, enable and disable them at boot, and experiment with masking. Check each service’s status before and after you modify it.
systemctl
utility to start, stop, reload, enable, and disable services.systemctl status
command to determine the status of system daemons and network services that the systemd utility started.systemctl
list-dependencies command lists all service units that a specific service unit depends on.In this module, you’ve learned how systemd manages services, and how to use systemctl to control them. You now know how to inspect, start, stop, reload, restart, enable, disable, mask, and unmask services—all essential skills for Linux system administration.
systemctl
Commandsystemctl
tmux
.To reinforce today’s topics, visit the linked YouTube video and consult the Red Hat documentation. Also, explore tools like tmux, pidof, and pgrep to improve your command-line workflow.
This lab tests your ability to manage services using systemctl
. Follow the instructions carefully, and be sure to check your work with status
, is-active
, and is-enabled
.
Thank you for your attention and participation. If you have questions, please ask now or follow up via the course platform. See you in the next module!
Created on 17 February 2025 by Dennis Kibbe. Last modified on 27 June 2025 18:07:00 by DNK.
Keyboard Shortcuts
This slide presentation was created by B6Plus. The audio accompanying this presentation is AI-generated.