What is a daemon in Linux?

Why Interviewers Ask This

Mid-level Linux / Shell Scripting roles require deep understanding of this topic. Interviewers ask this to separate candidates who truly understand the mechanics from those who only know surface-level concepts.

Answer

A daemon is a background process that runs continuously to provide services, typically started at boot and not tied to any user session. Daemon names often end in d: sshd (SSH server), nginx (web server), crond (cron scheduler), systemd. Daemons have no controlling terminal (TTY is ? in ps output). They typically detach from the terminal by forking and calling setsid(). Modern daemons are managed by systemd: systemctl start/stop/status/enable servicename. journalctl -u servicename views daemon logs. Daemons differ from regular background processes (command &) in their persistence and service-oriented nature.

Pro Tip

Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex Linux / Shell Scripting answers easy to follow.