Home >System Tutorial >LINUX >How To List All Running Daemons In Linux

How To List All Running Daemons In Linux

Joseph Gordon-Levitt
Joseph Gordon-LevittOriginal
2025-03-05 09:31:14477browse

A daemon is a background process that runs without direct user interaction. Linux systems use different init (initialization) systems to manage daemons. The common ones are Systemd, SysVinit, and OpenRC. In this tutorial, we will explain different ways to list all running daemons for each init system in Linux.

Table of Contents

Understanding Daemons, Processes and Init Systems

Before getting into the topic, allow me to briefly explain the following key terminologies, as they are important for understanding the rest of the tutorial.

  1. Daemon,
  2. Process,
  3. Init system.

If you want to manage services (like starting or stopping a web server), you need to understand daemons and the init system.

If you want to monitor or troubleshoot your system, you need to understand processes.

1. What is a Daemon?

A daemon is a background process that runs continuously on a Linux system, usually without direct user interaction.

Daemons provide essential services to the system or other programs. For example:

  • sshd manages SSH connections.
  • cron schedules tasks.
  • apache2 serves web pages.

Daemons typically start when the system boots and keep running until the system shuts down.

Example:

If you’re using a web server, the apache2 or nginx daemon runs in the background to handle web requests.

Fun fact: Daemon names often end in "d" (like sshd, crond).

2. What is a Process?

A process is any program or task that is currently running on your system.

Types of Processes:

  • Foreground Processes: These are started by the user and interact directly with the user (e.g., a web browser or text editor).
  • Background Processes: These run without user interaction (e.g., a file download or system update).
  • Daemons: A special type of background process that provides system services.

You can list all processes using commands like ps or top.

ps aux

You can the check a specific process's (E.g. nano) PID using command:

ps aux | grep nano

Example:

When you open a terminal, a bash process starts. If you run a command like ls, a new process is created to execute that command.

Related Read:

  • How To Find Parent Process ID (PPID) In Linux: A Step-by-Step Guide
  • How To Display Process Information Using Procs On Linux
  • How To Find Out How Long A Process Has Been Running In Linux
  • How To Change The Priority Of A Process In Linux
  • How To Suspend A Process And Resume It Later In Linux
  • Reptyr – Move A Running Process From One Terminal To Another Without Closing It

3. What is an Init System?

The init system is the first process that starts when a Linux system boots (with Process ID 1, or PID 1). It manages all other processes and services on the system.

The init system is responsible for:

  • Starting and stopping system services (daemons).
  • Managing dependencies between services.
  • Handling system shutdown and reboot.

Some of the Common Init Systems are:

  • Systemd: The most widely used init system in modern Linux distributions (e.g., Ubuntu, Fedora, Debian). Commands to manage systemd are systemctl, and journalctl.
  • SysVinit: An older init system used in traditional Linux distributions. Commands to manage SysVinit are service, /etc/init.d/.
  • OpenRC: A modern, flexible, and lightweight init system, often used in Gentoo,Alpine Linux, andArtix Linux.
  • Upstart: A transitional init system used in some older Ubuntu versions. Command to manage is initctl. It is now obsolete, as most recent Ubuntu distributions have moved tosystemd.

Example:

When you boot your system, the init system starts essential daemons like sshd (for SSH) and cron (for scheduled tasks).

The init system starts and manages daemons (background services). Both daemons and regular programs (like a web browser) are types of processes. You can list all processes using tools like ps, but you need init-specific commands (e.g., systemctl) to manage daemons.

To check your init system, run:

ps aux

Example Output:

ps aux | grep nano

This means the system uses Systemd.

Summary Table

How To List All Running Daemons In Linux

2. Display All Running Daemons using SysVinit

SysVinit uses init scripts stored in /etc/init.d/. It is used in older versions of Linux distros such as Debian 7, CentOS 6.

To list running services:

ps aux

Explanation:

  • service --status-all → Lists all services and their statuses.
  • grep " " → Filters out only running services (services with [ ] in the output).

Example Output:

ps aux | grep nano

Here, cron and networking are running, while apache2 is stopped.

3. View Running Daemons using OpenRC

OpenRC manages services using rc-status in some linux distributions such as Alpine Linux, and Gentoo.

To list active daemons:

ps --pid 1

Example Output:

PID TTY      TIME     CMD
1 ?        00:00:00 systemd

Cheatsheet for Listing Running Daemons in Linux

Init System Command to List Running Daemons
Init System Command to List Running Daemons
Systemd systemctl list-units --type=service --state=running
SysVinit service --status-all
OpenRC rc-status
Systemd
systemctl list-units --type=service --state=running

SysVinit

service --status-all

OpenRC

rc-status
ConclusionIn this tutorial, we discussed the concepts ofprocesses,daemons, and

init systems, and the key differences between processes and daemons

to clarify their roles in a Linux system.

We also covered how to list running daemons across different init systems, such as Systemd, SysVinit, and Upstart, along with practical examples.We hope this guide has been helpful!

The above is the detailed content of How To List All Running Daemons In Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn