Home >System Tutorial >LINUX >How To List All Running Daemons In Linux
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
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.
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.
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:
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).
A process is any program or task that is currently running on your system.
Types of Processes:
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
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:
Some of the Common Init Systems are:
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.
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:
Example Output:
ps aux | grep nano
Here, cron and networking are running, while apache2 is stopped.
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
Init System | Command to List Running Daemons | ||||||||
---|---|---|---|---|---|---|---|---|---|
|
systemctl list-units --type=service --state=running | ||||||||
SysVinit |
service --status-all | ||||||||
OpenRC |
rc-status |
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!