How does systemd work with systemctl?

Why Interviewers Ask This

This question targets practical, hands-on experience with Linux / Shell Scripting. Interviewers want to see if you've worked with these concepts in real projects, not just read about them. Strong answers include concrete examples.

Answer

systemd is the init system and service manager used by most modern Linux distributions. systemctl is its command-line interface. Key commands: systemctl start nginx (start), systemctl stop nginx, systemctl restart nginx, systemctl reload nginx (reload config without full restart), systemctl status nginx (detailed status and recent logs), systemctl enable nginx (start on boot), systemctl disable nginx, systemctl is-active nginx (check status in scripts). View logs for a service with journalctl -u nginx -f (follow live) or journalctl -u nginx --since "1 hour ago". Service unit files live in /etc/systemd/system/ — after editing, run systemctl daemon-reload.

Pro Tip

This topic has Linux / Shell Scripting-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.