Daemon is a term popularly used in computing especially in operating systems. Daemon is a process which is runs in the background in order to fulfill different tasks. The daemon term is popularly used in Unix, Linux, and BSD systems in order to define services. The Microsoft Windows counterpart of the daemon is service. The name daemon first used by the programmer of the MIT Project MAC. It is very interesting that the daemon comes from mythology where it is an imaginary being operating background. The daemon is used to run multiple tasks, programs as a background process.
In Unix, Linux and BSD there are different types of daemons used for different tasks and serving resources. these daemons use names with ending with a d as a process to depict it is a daemon, not a regular process.
Daemons can be managed using commands like
/etc/init.d scripts and commands etc. But today the systemctl command is the defacto standard to manage daemons. Existing daemons can be listed with the following systemctl command.
A specific daemon and its current status can be listed like below. In the following example we will list the SSH daemon which is named as
ssh as a services but the process it named as
$ systemctl status ssh
We can see from the
Man PID line which is sshd which is short form of the
SSH Daemon .
A daemon can be stopped with the
systemctl stop command like below. But this operation generally requires root privileges which can be provided with the sudo command like below.
$ sudo systemctl stop ssh
Daemon vs Program
You may ask what is difference between a daemon and program. Both of the daemon and program are executeable files which are running. The main difference is the daemon is designed and configured to start automatically, run in the background, accept connections etc. The program generally executed in foreground where it is used interactively and may provide a GUI. The naming of the daemon is set explicitly where the short form of daemon which is
d is added after the program name. For example the ssh daemon is named as
sshd or syslog daemon is named as
There are a lot of daemons which are very popular in Linux distributions which are used to accomplish different tasks.
autofs is a deamon that is used to automatically mount different file systems and partitions like NTFS, FAT32, EXT4, etc.
crond is another popular daemon which is used to run and execute for task scheduler.
dhcpd is used to executed DHCP related operations like request IP address from DHCP server or relase currently assigned IP address.
ftpd daemon is used to provide the FTP server or service to the FTP clients for file and folder transfer.