In the world of Linux system administration, managing processes is a fundamental task. Two common tools for handling services are service and systemctl. Both serve similar purposes, yet they differ in their usage, features, and underlying mechanisms. Understanding the distinctions between these tools is crucial for efficiently managing services in a Linux environment.
systemd gives us the systemctl commands which is mostly used to enable services to start at boot time. systemd is a collection of programs, background programs (daemons), and libraries for Linux operating systems. Its central component is the systemd init process, which serves as the first process for starting, monitoring and terminating further processes. However, it also offers other system components whose bandwidth ranges from booting to logging (journald). Systemd was programmed and is released as free software under the GNU Lesser General Public License (LGPL).
The service command is a wrapper script. Before systemd‘s introduction, it was a wrapper for /etc/init.d scripts and Upstart’s initctl command. Currently it is a wrapper for systemctl too.
---
SysVinit is the init system of the Unix operating system System V. A replica of it is used as a standard init system in some Linux distributions. SysVinit is the process that is the first to be started by the kernel and therefore gets the process ID 1. This first process starts all required system services based on the desired runlevels. SysVinit always starts the processes in a predetermined order and usually only starts a process when the previous process has been initialized. This makes it very slow compared to other (“parallel”) init systems. On the other hand, problems can be easily diagnosed as a result.
You can use service and systemctl command both depending on your need.

Service Command
The service command is a legacy tool inherited from SysVinit, the traditional init system used by many Linux distributions. It acts as a simple interface to control system services. With the service command, users can start, stop, restart, enable, disable, and check the status of services.
Usage
The basic syntax of the service command is:
1 | service [service_name] [action] |
For example
1 | service apache2 restart |
Features
- Simplicity: The service command provides a straightforward way to interact with services, making it suitable for quick, basic operations.
- Compatibility: It works across various Linux distributions that utilize SysVinit.
Limitations
- Lack of Granularity: The service command lacks the ability to handle service dependencies and advanced systemd features.
- Limited Logging: It may not provide detailed logging and error messages compared to systemctl.
You see the small output after running service apache2 status command:
1 2 | sudo service apache2 status * apache2 is running |
Systemctl
systemctl is the primary management tool for controlling system services in Linux distributions that use systemd, such as Ubuntu 16.04 and later, CentOS 7, and Fedora.
Usage
The general syntax of the systemctl command is:
1 | systemctl [action] [service_name]/ |
For example
1 2 3 4 5 6 7 8 9 10 11 | # Restarts a service only if it is running. systemctl try-restart name.service # Reloads configuration if it's possible. systemctl reload name.service # try to reload but if it's not possible restarts the service systemctl reload-or-restart name.service # example systemctl restart apache2.service |
systemctl is used to list units:
1 | systemctl list-units |
List service units:
1 | systemctl list-units --type=service |
List all available units (not only loaded and activated):
1 | systemctl list-unit-files |
You can control remote machines too:
1 | systemctl --host root@23.56.145.98 list-units |
You see the detailed output after running systemctl status nginx command:
1 2 3 4 5 6 7 8 9 10 11 | $ sudo systemctl status nginx ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2022-04-23 10:49:44 CEST; 16min ago Docs: man:nginx(8) Main PID: 6176 (nginx) Tasks: 2 (limit: 4632) Memory: 2.9M CGroup: /system.slice/nginx.service ├─6176 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; └─6177 nginx: worker process |
Features
- Dependency Management: systemctl can handle service dependencies efficiently, ensuring that services start and stop in the correct order.
- Enhanced Logging: It provides detailed logging and error messages, aiding in troubleshooting and diagnosing service-related issues.
- Unit File Management: systemctl operates based on unit files, which offer more flexibility and configurability compared to the simple init scripts used by service.
- Integration with systemd: As systemd’s native tool, systemctl fully utilizes systemd’s capabilities, including socket activation, cgroup management, and resource control.
- It loads services parallel at startup and provides on-demand activation of a service
Limitations
- Learning Curve: Due to its comprehensive feature set, mastering systemctl may require more effort compared to using the service command.
- Compatibility: While widely adopted, systemctl is not available on Linux distributions that do not use systemd as their init system.
Conclusion
Many Linux distributions now have init systems that allow services to be started in parallel. In part, this is done as a modification or extension of the “GNU System-V style init”, or as a complete replacement, such as OpenRC and/or runit (for BSD or Linux, such as Gentoo Linux). Ports of SMF (developed by Sun) and launchd (developed by Apple) were also considered, but since Linux does not have the “contract file system” necessary for SMF and launchd is also deeply integrated into the macOS operating system, these would only have been possible with greater effort. However, these two systems were the godfather for the similar init systems Upstart (developed by Canonical) in Ubuntu from 2006 as well as the younger systemd (developed by Red Hat) from 2010 on Fedora. Other distributions adopted them, such as Chromium OS Upstart and openSUSE systemd. Around 2014, systemd became established in almost all Linux distributions. This also forced Canonical to replace Upstart with systemd in Ubuntu. Further development of Upstart has now been discontinued. Since some Linux distributions no longer work without systemd, there have even been forks, e.g. with Devuan, a Debian without systemd, or Artix Linux, an Arch Linux based on Manjaro Without systemd. Other Linux distributions, such as Gentoo Linux, continue to offer a choice of several compatible init systems.
In summary, both service and systemctl are essential tools for managing services in Linux environments. The choice between them depends on the specific requirements of the system and the preferences of the user. For simple, legacy systems, the service command may suffice. However, for modern distributions and complex environments, systemctl offers advanced features and better integration with systemd, making it the preferred choice for managing services efficiently. Understanding the differences between these tools empowers Linux administrators to make informed decisions and effectively manage processes in their systems.