- 1 1. Introduction
- 2 2. How to Display a List of Services with systemctl
- 3 3. Basic Service Management with systemctl
- 4 4. Useful systemctl Options and Advanced Techniques
- 5 5. Common Issues and Troubleshooting
- 6 6. Summary
- 7 7. Frequently Asked Questions (FAQ)
- 7.1 Q1. What is the difference between systemctl and the service command?
- 7.2 Q2. What is the difference between list-units and list-unit-files?
- 7.3 Q3. Can services in a static state be started?
- 7.4 Q4. A service is masked and cannot be started. What should I do?
- 7.5 Q5. Is there a GUI method to view service status?
- 7.6 Q6. Where should I place custom unit files?
1. Introduction
When using Linux, there are many situations where you want to check the status of services or view a list of running processes. In such cases, the systemctl command is extremely useful.
This command works with systemd, the startup system and service manager used in modern Linux distributions. It provides a wide range of functions, including checking service (unit) status, starting, stopping, restarting services, and displaying service lists.
From the perspective of a “systemctl service list,” you can not only view currently active services but also disabled services and those configured for automatic startup, allowing you to understand the overall system configuration from multiple angles.
This chapter briefly explains what systemctl is and outlines what you will learn in this article.
What Is systemctl?
systemctl is the standard tool for controlling and inspecting various “units” such as services, targets, and mount points on systemd-based Linux distributions.
For example, it is used to start or stop services such as Apache (httpd) and SSH, as well as to display their status in list form.
The Relationship Between systemd and systemctl
systemd is the core mechanism responsible for Linux startup processes and service management, replacing older systems such as SysVinit and Upstart. The command-line tool used to interact with systemd is systemctl.
In other words, if systemd is the command center, systemctl acts as the operator issuing instructions.
What You Will Learn in This Article
This article answers the following questions:
- How can you view a list of currently running services?
- How do you display all services, including inactive ones?
- How can you check whether a service starts automatically at boot?
- How should you interpret the output of service lists?
To ensure clarity for Linux beginners, command examples and explanations of output are provided in detail.
2. How to Display a List of Services with systemctl
In Linux system administration, quickly understanding the list of services is extremely important. Using the systemctl command, you can easily check active services, inactive services, and startup configuration settings.
This section explains service listing methods from the following three perspectives:
- List of active services
- List of all services (including inactive ones)
- List of service unit files (including startup settings)
2.1 Displaying a List of Currently Active Services
To check services that are currently running, use the following command:
systemctl list-units --type=serviceThis command displays a list of active services. The output includes the following fields:
| Field | Description |
|---|---|
| UNIT | Service name (e.g., ssh.service) |
| LOAD | Whether the unit file is loaded |
| ACTIVE | Service state (e.g., active, inactive, failed) |
| SUB | More detailed status (e.g., running, exited, dead) |
| DESCRIPTION | Service description |
This information allows you to determine, for example, whether nginx is running or which services are currently active.
2.2 Displaying All Services Including Inactive Ones
By default, list-units shows only active services. To include inactive services, add the --all option.
systemctl list-units --type=service --allThis displays inactive services and those that have never been started.
You can further filter results by service state using the --state= option:
systemctl list-units --type=service --state=inactiveThis is useful when you want to view only stopped services.
2.3 Viewing a List of Service Unit Files
To check which services are enabled or disabled at boot, use the following command:
systemctl list-unit-files --type=serviceThis command displays all service unit files along with their enabled or disabled states.
| STATE | Description |
|---|---|
| enabled | Automatically starts at boot |
| disabled | Does not start automatically |
| static | Cannot be enabled or disabled manually |
| masked | Explicitly disabled and cannot be started |
This list helps you visually understand which services start at boot and identify mistakenly masked services.
3. Basic Service Management with systemctl
The systemctl command allows you to start, stop, restart services, and configure startup behavior.
3.1 Starting a Service
sudo systemctl start service-nameExample:
sudo systemctl start httpd.service3.2 Stopping a Service
sudo systemctl stop service-nameExample:
sudo systemctl stop sshd.service3.3 Restarting a Service
sudo systemctl restart service-nameExample:
sudo systemctl restart nginx.service3.4 Checking Service Status
systemctl status service-nameExample:
systemctl status mysql.service3.5 Enabling Automatic Startup
sudo systemctl enable service-nameExample:
sudo systemctl enable docker.service3.6 Disabling Automatic Startup
sudo systemctl disable service-nameExample:
sudo systemctl disable cups.service3.7 Checking Startup Status
systemctl is-enabled service-nameenabled4. Useful systemctl Options and Advanced Techniques
4.1 Listing Service Dependencies
systemctl list-dependencies service-name4.2 Viewing Unit File Contents
systemctl cat service-name
4.3 Reloading Unit Files
sudo systemctl daemon-reexecsudo systemctl daemon-reload4.4 Viewing Service Logs
journalctl -u service-name5. Common Issues and Troubleshooting
5.1 When a Service Fails to Start
systemctl status service-namejournalctl -xe5.2 Understanding Error Messages in status Output
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code)
5.3 Services That Stop Immediately After Starting
- Configuration errors
- Port conflicts
- Missing files or directories
- Insufficient permissions
5.4 When a Service Is Masked
sudo systemctl unmask service-name6. Summary
Service management is an essential part of Linux system operations, and systemctl plays a central role in controlling and understanding system services.
7. Frequently Asked Questions (FAQ)
This section answers common questions about systemctl and service management.
Q1. What is the difference between systemctl and the service command?
A1.systemctl is a service management command designed for systemd-based systems and is the standard tool used by most modern Linux distributions such as Ubuntu, CentOS, and Fedora.
In contrast, the service command was used with older SysVinit-based systems. While it may still exist for compatibility reasons, using systemctl is strongly recommended in systemd environments.
Q2. What is the difference between list-units and list-unit-files?
A2.
list-unitsdisplays currently loaded units, meaning services that are running or have been used recently.list-unit-filesdisplays all unit files and their enablement status (enabled, disabled, etc.).
In short, one shows what is currently active, while the other shows how services are configured.
Q3. Can services in a static state be started?
A3.
Yes, services in a static state can be started manually using start. However, they cannot be enabled for automatic startup at boot.
This is because static services are designed to be started as dependencies of other units.
Q4. A service is masked and cannot be started. What should I do?
A4.
A masked service is completely disabled and cannot be started. To resolve this, unmask the service using the following command:
sudo systemctl unmask service-nameAfter unmasking, you can start the service normally.
Q5. Is there a GUI method to view service status?
A5.
Depending on the distribution, tools such as gnome-system-monitor, KSysGuard, or Cockpit allow you to view service status through a graphical interface.
However, for advanced operations such as enabling or disabling services at boot, systemctl remains the most reliable method.
Q6. Where should I place custom unit files?
A6.
Custom unit files are typically placed in /etc/systemd/system/. After editing or adding a unit file, always run the following command:
sudo systemctl daemon-reloadYou can then manage the service normally using start or enable.

