LESSON · 1 OF 6

What is systemd

What is systemd

Every long-running program on a modern Linux server is a "service", and almost every service is managed by systemd. When the machine boots, systemd is the first process to start (PID 1), and it launches everything else: network, SSH, cron, your database, your web server.

Why not just run things with nohup?

You met nohup in the previous topic. It keeps a command alive after you log out, but it doesn't handle any of:

  • Starting automatically when the machine boots.
  • Restarting if the program crashes.
  • Making sure dependencies (like the network) are up first.
  • Collecting the program's logs where the rest of the system's logs live.

systemd does all of these. When you deploy a service to a Linux box, you don't run it with &, you write a systemd unit for it.

Units

A unit is systemd's word for "a thing it manages". The most common type is service, but systemd also manages timers, sockets, mounts, and more. Every unit has a name that ends in its type:

  • ssh.service - the SSH daemon
  • cron.service - the cron scheduler
  • systemd-resolved.service - DNS resolution
  • backup.timer - a scheduled job

You control units with one command, systemctl. You read their logs with journalctl. That's the whole daily surface.

Spin up a fresh environment and practice live.
linux-devops-basic · fresh machine · ready in under a minute