Introduction to Linux Services and Daemons
In Linux, a Service is a program that runs in the background and provides important functions like web server, database, or networking.
A Daemon is also a background process, usually started at boot time, which keeps running without direct user control.
Difference Between Service and Daemon
- Service: A program managed by the system (like Apache, MySQL).
- Daemon: A background process that waits to perform tasks (like sshd, crond).
- In simple terms: Daemon = background process, Service = managed daemon.
Managing Services with systemctl
Most modern Linux systems use systemctl
to manage services.
systemctl status sshd # Check status of service
systemctl start sshd # Start service
systemctl stop sshd # Stop service
systemctl restart sshd # Restart service
systemctl enable sshd # Enable service at boot
systemctl disable sshd # Disable service at boot
Checking All Services
systemctl list-units --type=service
Old Method Using service Command
In older Linux versions, services were managed using the service
command.
service sshd status
service sshd start
service sshd stop
Important Daemons in Linux
- sshd: Secure Shell Daemon (remote login)
- crond: Scheduler Daemon (runs tasks automatically)
- httpd/nginx: Web server Daemons
- mysqld: Database Daemon
Check if a Daemon is Running
ps aux | grep sshd
Summary
Services and Daemons are the backbone of Linux. As an Administrator, you will often start, stop, enable, and check services.
Remember: systemctl
is the modern command, while service
is older.