This strange term is a relic from Unix history, but daemons are still used today. The term is synonymous with the concept of a "service", a task that runs continuously, usually without user interaction.
There are several common examples of daemons, and even if you don't need to know exactly how they work, being able to identify them is at least useful.
What is a demon
A daemon, or Disk And Execution MONitor, is a program that runs as a background process and not as an interactive process. Daemons are common in network tools and system administration tasks. You can control some daemons by sending signals to them.
How do you pronounce “daemon”?
Despite appearances, the word daemon is usually pronounced the same way as the word "demon". Rest assured, it has nothing to do with satanic rituals. In fact, the name ultimately derives from Greek mythology and the concept of a guiding mind that works tirelessly in the background. With that in mind, it's a very apt name!
How do demons work?
On Unix systems, the term daemon is often used synonymously with the term background process. In other words, it is a process that has been detached from each shell and does not go on interactively. A real daemon should also assign itself as a child of the special inside Process that has the special process ID number 1.
Other typical tasks involved in isolating the daemon include:
Sandboxing by removing unnecessary variables from its environment.
Set the root directory (/) as the current working directory of the process.
Redirect file descriptions for input, output, and errors in log files or / dev / null.
Other systems such as Windows and macOS also use daemons. In the case of Windows, services are the closest equivalent.
What are some common demons?
Cron (crond) is a daemon that runs other programs on a schedule. Most Unix systems configure it to run automatically at startup. It wakes up every minute, checks configuration files, and executes any commands that should be run during that minute. Cron is clever enough to react to changes to crontab files as they change. You don't have to restart it yourself.
Web servers like Apache's httpd, often run as daemons – that's what the "d" stands for. The Apache daemon processes incoming requests by creating a pool of child processes to share the load. You can use a utility such as apachectlto make it easier to control the httpd daemon itself.
In the end, sshd is another common example of a daemon, this time one that handles SSH connections. Again, it usually starts at boot and runs indefinitely, relying on signals for certain operations. For example, a SIGHUP signal causes sshd to execute itself again and reload its configuration file.
Demons are vital service providers
Daemons run continuously and perform important tasks to keep your computer running. They are often involved when a computer has to act as a server on behalf of other clients.
Daemons are an important component of a Linux server. If you're new to setting up a server, check out our tips to get you started.
10 Linux hardening tips for novice system administrators
Are you taking your first steps as a Linux system administrator? Here are the operating system hardening tricks you need to keep your systems secure.
About the author
(59 articles published)
Bobby is a technology enthusiast who has worked as a software developer for nearly two decades. Passionate about games, he works as a review editor at Switch Player Magazine, and delves into all aspects of online publishing and web development.
From Bobby Jack
Subscribe to our newsletter
Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!
Click here to subscribe