Sitemap

Linux service vs systemctl: Understanding Old and Modern Service Management

--

A practical guide to managing Linux services, troubleshooting legacy systems, and understanding what happens under the hood.

Introduction: Why Does Linux Have Two Commands for the Same Job?

Imagine you’re learning Linux and encounter this command:

service apache2 status

Then, in another tutorial, you see:

systemctl status apache2

Both commands appear to perform the same task: checking whether Apache is running.

So, what’s the difference?

Is service deprecated? Is systemctl its replacement? And what happens when you're working with an older Linux distribution like Metasploitable 2, where systemctl might not even exist?

These questions are more important than they seem.

Understanding Linux service management isn’t just about memorizing commands. It’s about understanding how Linux starts, manages, monitors, and controls background processes.

In this article, we’ll explore both commands, their historical differences, practical applications, and how to troubleshoot services when traditional management tools fail.

1. What Is a Linux Service?

A Linux service is a program that runs in the background to provide functionality to the operating system or other applications.

Unlike a regular application that you launch and interact with directly, a service typically operates without requiring continuous user interaction.

Examples include:

Service                                 Function
Apache Hosts websites and web applications
SSH Provides remote system access
MySQL Database management
Cron Executes scheduled tasks
Docker Manages containers
NetworkManager Manages network connections

Think of a service like a generator.

You need to start it, stop it, restart it, or check whether it’s running.

Linux provides commands to perform these operations.

2. The Traditional Approach: service

Before systemd became widely adopted, Linux distributions commonly used SysV init for system initialization and service management.

The traditional service command follows this syntax:

service <service-name> <action>

For example:

service apache2 status

This checks Apache’s status.

Other operations include:

service apache2 start
service apache2 stop
service apache2 restart
service apache2 reload

Understanding the commands

  • start — Starts the service.
  • stop — Stops the service.
  • restart — Stops and starts the service again.
  • reload — Requests that the service reload its configuration.
  • status — Displays the service's current state.

The service command is considered a legacy interface, but it has not disappeared. Many modern distributions retain it for compatibility.

3. The Modern Approach: systemctl

Enter systemctl, the command-line utility used to interact with systemd.

Systemd is an init system and service manager used by many modern Linux distributions, including Ubuntu, Debian, Fedora, and Kali Linux.

Its general syntax is:

systemctl <action> <unit>

For example:

systemctl status apache2

Notice the difference:

service apache2 status

Compared with:

systemctl status apache2

The command structure changes, but the objective is similar.

Common systemctl commands

sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl restart apache2
sudo systemctl reload apache2
sudo systemctl status apache2

When checking the status, you might encounter:

● apache2.service - The Apache HTTP Server
Loaded: loaded
Active: active (running)

The most important line is:

Active: active (running)

This indicates that systemd considers the Apache service active.

Other possible states include:

  • inactive (dead) — The service is not currently active.
  • failed — The service encountered a failure.
  • activating — The service is in the process of starting.

4. The Difference Between start and enable

This is one of the most misunderstood concepts in Linux service management.

Consider:

sudo systemctl start apache2

This starts Apache immediately.

However, it does not necessarily configure Apache to start automatically after a system reboot.

For that, we use:

sudo systemctl enable apache2

This configures the service to start automatically during boot, according to its systemd configuration.

We can combine both operations:

sudo systemctl enable --now apache2

This enables Apache at boot and starts it immediately.

What about disable and stop?

These commands are also different:

sudo systemctl stop apache2

Stops Apache now.

sudo systemctl disable apache2

Removes its automatic startup configuration.

Disabling a service does not necessarily stop an already-running instance.

CommandPurposestartStart nowstopStop nowrestartStop and start againreloadReload configurationenableEnable automatic startupdisableDisable automatic startupenable --nowEnable and start immediately

5. Reload vs Restart: Are They the Same?

No.

Suppose you modify Apache’s configuration file.

You have two common options:

sudo systemctl restart apache2

Or:

sudo systemctl reload apache2

A restart stops and starts the service again.

A reload asks the running service to reread its configuration without a full service restart, if supported.

RESTART
Apache
↓
Stop
↓
Start again
RELOAD
Apache continues running
↓
Reads updated configuration
↓
Continues operating

For configuration changes, reload can reduce interruption, but always confirm that the service supports it and that the configuration is valid.

6. Why Did Linux Move From SysV Init to systemd?

Historically, Linux distributions used different initialization systems.

One traditional approach was SysV init.

Service scripts were commonly stored in:

/etc/init.d/

For example:

/etc/init.d/
├── apache2
├── ssh
├── mysql
└── networking

These scripts were used to start, stop, and manage services.

Get Adefemi Oluwaseun (whoami)’s stories in your inbox

Join Medium for free to get updates from this writer.

As Linux systems evolved, systemd gained widespread adoption.

Modern systemd-based systems manage units such as:

apache2.service
ssh.service
cron.service
NetworkManager.service

The systemctl command provides an interface for managing these units.

Importantly, systemd does more than manage services. It also handles other unit types, including:

Unit                                           Purpose
.service Services
.socket Socket activation
.timer Scheduled activation
.mount Filesystem mount points
.target Groups of units

This is why systemctl is more than a simple replacement for service.

7. Is the service Command Deprecated?

The accurate explanation is:

service is an older service-management interface, while systemctl is the modern, generally preferred interface on systemd-based Linux systems.

However, saying that service is completely deprecated everywhere would be inaccurate.

On many modern Debian-based distributions, service remains available for backward compatibility and may delegate operations to systemd.

Conceptually:

service apache2 status
|
v
Compatibility interface
|
v
systemd
|
v
apache2.service

Whereas:

systemctl status apache2
|
v
systemd
|
v
apache2.service

For modern Linux administration, learn systemctl first, but understand service because it remains relevant when working with older systems and scripts.

8. Practical Linux Lab: Managing Apache

Let’s apply what we’ve learned.

First, install Apache on a Debian-based system:

sudo apt update
sudo apt install apache2

Check its status:

systemctl status apache2

Stop it:

sudo systemctl stop apache2

Check its status again:

systemctl status apache2

Start it:

sudo systemctl start apache2

Enable automatic startup:

sudo systemctl enable apache2

Check whether it’s enabled:

systemctl is-enabled apache2

Check whether it’s currently active:

systemctl is-active apache2

Remember:

is-enabled
|
v
Is it configured to start at boot?
is-active
|
v
Is it currently active?

These are two different questions.

9. What Happens When You’re Working With Metasploitable 2?

Here’s where Linux history becomes particularly useful for cybersecurity learners.

Metasploitable 2 is an intentionally vulnerable Linux virtual machine used for penetration testing education.

Because it is based on an older Ubuntu environment, it uses the traditional SysV init architecture rather than systemd.

If you run:

systemctl status apache2

You may receive:

systemctl: command not found

This doesn’t automatically mean something is wrong with your installation.

It means the system may not have systemd or its command-line utility.

Try:

service apache2 status

If necessary, use the traditional init script directly:

/etc/init.d/apache2 status

To view available service scripts:

ls /etc/init.d/

This is one reason cybersecurity professionals should understand both modern and legacy Linux environments.

10. What If Both service and systemctl Fail?

Sometimes, you need to investigate beyond the service manager.

Instead of immediately concluding that a service is down, check the actual process.

Method 1: ps

ps aux | grep '[a]pache2'

This searches for Apache processes.

Method 2: pidof

pidof apache2

If Apache is running, this may return one or more process IDs (PIDs).

Method 3: pgrep

pgrep -a apache2

This displays matching process IDs and command lines.

Method 4: netstat

On older Linux systems:

netstat -tulpn

To check HTTP port 80:

netstat -tulpn | grep ':80'

On modern systems, you can use:

ss -tulpn

For SSH:

ss -tulpn | grep ':22'

For MySQL:

ss -tulpn | grep ':3306'

A listening port provides evidence that a process is accepting connections on that port. However, a listening port alone doesn’t prove that the application is healthy or functioning correctly.

11. My Linux Service Troubleshooting Cheat Sheet

When checking a service, use this general approach:

CHECK SERVICE
|
+----------+----------+
| |
Modern OS Legacy OS
| |
systemctl service
| |
| /etc/init.d/
| |
+----------+----------+
|
Check process
|
+--------+--------+
| | |
ps pgrep pidof
|
Check port
|
ss / netstat
Press enter or click to view image in full size
Check Service on Linux

This approach is useful when troubleshooting Linux servers, cybersecurity labs, CTF environments, and older virtual machines.

Final Thoughts

Linux service management is a perfect example of why understanding the underlying technology matters more than memorizing commands.

The key differences are:

  • service — Traditional/legacy service-management interface.
  • systemctl — Modern command-line interface for systemd.
  • /etc/init.d/ — Traditional SysV init service scripts.
  • ps, pgrep, and pidof — Tools for checking processes.
  • ss and netstat — Tools for inspecting network sockets and listening ports.

For modern Linux systems that use systemd, make systemctl your primary tool.

But when working with older systems like Metasploitable 2, knowing the legacy approach can save you considerable troubleshooting time.

Don’t just memorize commands. Understand what is happening underneath them.

That is how you move from being someone who uses Linux commands to someone who understands Linux.

Continue Learning

If you’re learning Linux for cybersecurity, practice these commands in Kali Linux, Ubuntu, and Metasploitable 2.

Build your understanding through hands-on exercises:

Learn → Practice → Troubleshoot → Document → Repeat.

Follow me for more practical Linux, cybersecurity, ethical hacking, and security research tutorials.

--

--

Adefemi Oluwaseun (whoami)
Adefemi Oluwaseun (whoami)

Linux Kernel Research & Testing | Ethical Hacking | SOC & Threat Hunting (Intermediate) | Linux & Windows | Cybersecurity Educator