Daemon in Linux
What is Daemon ?
A daemon in Linux is a silent worker that performs essential tasks in the background without disturbing . It operates on the computer, managing activities such as internet connections, printing files, and maintaining accurate system time. While you may not be aware of it, daemons play a crucial role in ensuring your computer functions smoothly.
Linux servers host network applications that assist clients and network devices. These applications, referred to as services, are initiated by the server autonomously, without human intervention. When services on a Linux server can self-start, they are termed daemons. Daemons operate discreetly in the background, ready to respond to client connection requests. Additionally, a super-server functions behind the scenes, managing connection requests for multiple services. Upon accepting a request, the super-server initiates the appropriate service.
Characteristics of Daemons
Background Operation: Daemons work silently in the background, carrying out tasks without needing user input.
Autostart: Normally, daemons start automatically when the system boots up and keep running until the system is shut down.
Resource Management: They effectively handle system resources like CPU time, memory, and disk space to complete their assigned tasks.
Persistence: Daemons run continuously in the background, ensuring that services stay accessible for users and other applications.
Independence: They can function independently of user sessions, running even when no users are logged into the system.
Examples of Daemons
Web Servers: Daemons like Apache HTTP Server or Nginx serve web pages to users who request them through web browsers.
Email Servers: Daemons such as Postfix or Sendmail handle the sending and receiving of emails on mail servers.
Print Spoolers: Daemons like CUPS manage print jobs sent from user applications to printers.
System Monitoring: Daemons like systemd or cron perform system monitoring and automation tasks, such as scheduling periodic tasks or managing system services.
Command lines
ps
We can use the ps
command with options to display a list of running processes, including daemons:
bashCopy codeps aux | grep daemon
This command lists all processes (including daemons) and filters the output to show only those containing the word "daemon."
Let's take an example:
Daemon Name: httpd
(Apache HTTP Server Daemon)
Function: httpd
helps serve web pages and handle requests on a Linux server.
Start:
sqlCopy codesudo systemctl start httpd
This starts the Apache HTTP Server.
Stop:
arduinoCopy codesudo systemctl stop httpd
This stops the Apache HTTP Server.
Restart:
Copy codesudo systemctl restart httpd
This restarts the Apache HTTP Server.
Check Status:
luaCopy codesudo systemctl status httpd
This checks if the Apache HTTP Server is running.
Enable Auto Start:
bashCopy codesudo systemctl enable httpd
This makes the Apache HTTP Server start automatically when the system boots up.
Disable Auto Start:
bashCopy codesudo systemctl disable httpd
This stops the Apache HTTP Server from starting automatically when the system boots up.
Summary: httpd
is a daemon that serves web pages on a Linux server. You can start, stop, restart, check its status, and configure whether it starts automatically using these commands.
Subscribe to my newsletter
Read articles from sudip adhikari directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
sudip adhikari
sudip adhikari
I am an explorer of IT field.