We’ve reached Day 6 of the 30 Days of Linux Challenge, and today’s topic is one that lies at the core of how Linux systems run in the background: service and daemon management using systemd and systemctl.

If you've ever wondered how your Linux system starts services automatically at boot, keeps applications like SSH or Apache running, or manages background processes — this is how it works.

📚 Table of Contents

What Are Daemons and Services?

A daemon is a background process that runs continuously or is triggered by specific events. These processes:

  • Start during boot
  • Run silently in the background
  • Manage tasks like networking, logging, scheduling, and remote access

Examples include:

  • sshd – manages SSH access
  • cron – handles scheduled tasks
  • httpd – the Apache web server
  • docker – container runtime service

In Linux, these are referred to as services, and they’re controlled using a tool called systemctl.

What Is systemd?

systemd is the init system used by most modern Linux distributions. It is responsible for:

  • Booting the system
  • Managing system processes and services
  • Handling logging, mounts, timers, and more

It replaced older systems like SysVinit and is now standard in distributions like Ubuntu, CentOS, Fedora, RHEL, and Debian.

At the heart of systemd is systemctl, the command-line utility we use to interact with it.

Introducing systemctl

The systemctl tool allows you to:

  • Start or stop services manually
  • Enable or disable services at boot
  • Check the status of active services
  • Reload service configuration
  • Restart crashed or misbehaving services

It’s one of the most-used tools by Linux administrators.

Common systemctl Commands

Here are some of the most essential commands you'll use:

  1. Check system boot and service status
    systemctl status

  2. Check a specific service
    systemctl status ssh

  3. Start/Stop/Restart a service

  4. sudo systemctl start nginx

  5. sudo systemctl stop nginx

  6. sudo systemctl restart nginx

  7. Enable a service at boot
    sudo systemctl enable nginx

  8. Disable a service at boot
    sudo systemctl disable nginx

  9. Reload a service’s configuration
    sudo systemctl reload nginx

  10. Check if a service is enabled
    systemctl is-enabled nginx

  11. List all active services
    systemctl list-units --type=service

Use sudo where required — most service management tasks need elevated privileges.

Understanding Units in systemd

In systemd, a unit is any resource it can manage. Services are just one type of unit.

Unit Type Description
.service :: A running service or daemon
.socket :: A communication socket
.mount :: A mounted filesystem
.timer :: Scheduled task
.target :: A group of services (e.g., multi-user.target)
Most of the time, you’ll be working with .service units, such as nginx.service, sshd.service, etc.

Real-World Examples
Here’s how you might use systemctl on a live server:

  1. Restart a web server after updating config:
  2. sudo systemctl restart apache2

  3. Enable the firewall to start automatically:

  4. sudo systemctl enable ufw

Image description

  1. Check the status of Docker:
  2. sudo systemctl status docker

Image description

  1. Disable an unused service:
  2. sudo systemctl stop bluetooth
  3. sudo systemctl disable bluetooth

Image description

Disabling unnecessary services can improve boot speed and security.

Try It Yourself

Here are a few safe commands to try:

  1. sudo systemctl status
  2. sudo systemctl list-units --type=service
  3. sudo systemctl start cron
  4. sudo systemctl stop cron
  5. sudo systemctl restart cron
  6. sudo systemctl enable cron
  7. sudo systemctl disable cron You can replace cron with any installed service on your system.

Why This Matters

  1. Managing services is a core responsibility in Linux system administration and DevOps.
  2. With systemctl, you can:
  3. Keep critical services running reliably
  4. Automate behavior at boot time
  5. Troubleshoot crashes or misconfigured services
  6. Secure the system by disabling unneeded daemons
  7. Improve system uptime and stability
  8. Whether you’re working on a web server, deploying containers, or managing cloud infrastructure — understanding systemctl gives you full control over the system's heartbeat.