Get AI summaries of any video or article — Sign up free
start, stop, restart Linux services (daemon HUNTING!!) // Linux for Hackers // EP 6 thumbnail

start, stop, restart Linux services (daemon HUNTING!!) // Linux for Hackers // EP 6

NetworkChuck·
5 min read

Based on NetworkChuck's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Daemons are background processes that power core system functions; they often appear as processes with names ending in “d” (e.g., sshd, ntpd).

Briefing

Linux runs on background services—often called daemons—that start automatically, keep systems functioning, and handle tasks like networking, time sync, and remote access. The practical takeaway is that these “demons” are just processes managed in a structured way, and mastering their lifecycle—start, stop, restart, reload, and enable/disable—turns troubleshooting from guesswork into a repeatable routine.

The foundation starts with distinguishing interactive processes from daemon processes. When a user launches an app like Sublime Text or opens Nano, the resulting processes appear and disappear as the program starts and closes. By contrast, many processes running on a system without user interaction are daemons—services that “just do their thing.” A quick way to spot them is by name: daemon services commonly end with a trailing “d” (for example, sshd for SSH and ntpd for Network Time Protocol). Using process inspection commands such as ps with filtering (ps -aux | grep <name>) helps confirm what’s running and what stops when an application exits.

Control of those daemons centers on systemd, the master service manager and init system used on modern Linux distributions. systemd is the first process created during boot (with PID 1) and then forks into other processes, which can be visualized with tools like ps tree. systemd’s job is twofold: it initializes the system during startup and manages services afterward. In systemd terminology, daemons are “units,” which can represent services, sockets, timers, mounts, and more.

The command-line workhorse is systemctl. With it, administrators can stop and start services (e.g., sudo systemctl stop sshd, then sudo systemctl status sshd to verify it’s inactive or active), restart them, and sometimes reload configuration without a full restart. systemctl also handles boot behavior: sudo systemctl disable <service> prevents a unit from starting on the next reboot, while sudo systemctl enable <service> schedules it to start automatically later. Quick checks like systemctl is-active and systemctl is-enabled help confirm both runtime state and boot-time configuration.

Finding what’s running requires knowing how systemctl lists units. systemctl list-units shows units systemd has loaded and is actively aware of, so a service that isn’t loaded may not appear. To locate services that exist but aren’t active, systemctl list-unit-files is used, revealing states like disabled. A troubleshooting scenario with nginx shows the workflow: enable it for boot, attempt to start it, then use journalctl (systemd’s logging facility) to diagnose failures. In the example, nginx fails because port 80 is already in use, and the logs point directly to the binding conflict.

Overall, the episode frames daemon management as essential Linux admin and hacker skill: identify services, control them through systemd/systemctl, and use journalctl to resolve failures quickly and accurately.

Cornell Notes

Linux daemons are background processes that keep the system running—networking, time sync, remote access, and more. Daemons can be identified like regular processes (often with names ending in “d,” such as sshd and ntpd), but the real control mechanism is systemd, the master init/service manager (PID 1). systemctl provides the core commands to start, stop, restart, reload, and to enable/disable services for the next boot, with status checks via systemctl status, is-active, and is-enabled. When a service fails to start, journalctl supplies the logs needed to pinpoint the cause, such as nginx failing because port 80 is already in use.

How can someone tell the difference between an interactive process and a daemon process on Linux?

Interactive processes start when a user launches an application and stop when the application closes. For example, launching Sublime Text creates processes that appear in ps output and disappear after closing the app. Daemon processes run without direct user interaction; they’re typically long-lived and handle system functions in the background. A practical way to spot them is to look for common daemon naming patterns—services often end with “d” (e.g., sshd, ntpd).

What role does systemd play in daemon management, and why does it matter?

systemd is both the init system and the service manager. During boot, the kernel hands control to systemd, which then starts and coordinates other processes; it’s the first process created (PID 1). Because systemd is the central manager, administrators route service control through it rather than managing daemons directly.

What are the most important systemctl actions for controlling services?

The core lifecycle actions are start, stop, restart, and (when supported) reload. For example: sudo systemctl stop sshd stops the SSH service, sudo systemctl start sshd brings it back, and sudo systemctl restart sshd kills and restarts it. reload is useful when a daemon can apply configuration changes without a full restart; if reload isn’t supported, the service may need a restart instead.

How do enable/disable commands differ from start/stop?

start/stop affect the service immediately in the current running system. enable/disable affect whether the service will start automatically on the next boot. For instance, sudo systemctl disable ntp prevents it from starting at boot, even if it may still be active right now. sudo systemctl enable ntp schedules it to start on future boots without necessarily starting it immediately.

Why might nginx not appear in systemctl list-units, and how should it be found anyway?

systemctl list-units typically lists units that systemd has parsed/loaded into memory, which often means only active (or otherwise loaded) units show up. If nginx isn’t loaded, it may not appear. To find services that exist but aren’t loaded or are disabled, use sudo systemctl list-unit-files and filter (e.g., grep nginx).

When a service fails to start, what diagnostic path is used here?

After a failed sudo systemctl start <service>, the workflow is to check status and then consult journalctl for systemd logs. In the nginx example, journalctl output indicates nginx couldn’t bind to port 80 because it was already in use by another service. The fix isn’t covered in the episode, but the logs identify the exact conflict.

Review Questions

  1. What naming pattern in process names can hint that a process is a daemon (and give two examples)?
  2. Describe the difference between systemctl start/stop and systemctl enable/disable in terms of current runtime vs next boot.
  3. If nginx fails to start, what two systemd-related commands are used to confirm the failure and locate the root cause?

Key Points

  1. 1

    Daemons are background processes that power core system functions; they often appear as processes with names ending in “d” (e.g., sshd, ntpd).

  2. 2

    Interactive processes start when a user launches an app and disappear when the app closes, which can be verified with ps filtering.

  3. 3

    systemd is the central init and service manager (PID 1), so daemon control flows through it.

  4. 4

    systemctl is the main tool for start, stop, restart, and (when supported) reload, plus status verification.

  5. 5

    enable/disable controls whether a service starts on the next boot, while start/stop changes the current running state.

  6. 6

    systemctl list-units may omit services not loaded into memory; systemctl list-unit-files helps find disabled or inactive units.

  7. 7

    journalctl is the key log source for diagnosing service startup failures, including port-binding conflicts like nginx on port 80.

Highlights

systemd is the first process created during boot (PID 1) and then branches into other processes, which can be visualized with ps tree.
systemctl enable/disable changes boot behavior without necessarily starting or stopping the service immediately.
A failed nginx start can be traced in journalctl to a port 80 binding conflict—an example of how logs turn troubleshooting into a targeted fix.

Topics

  • Daemon vs Process
  • systemd
  • systemctl
  • Service Lifecycle
  • journalctl Troubleshooting

Mentioned