Hands-on guide series

Processes and Services on Linux: A Hands-On Guide

A nine-part, hands-on guide to what runs on a Linux server: processes and signals, background jobs, systemd services and journald, enabling and masking units, cron, systemd timers, and resource limits. Every command run on a live Ubuntu server.

9 parts59 min totalBy Amith Kumar

What you will build

Security is layers, not a switch. Each part closes a different category of attack, from the automated sweep that finds a brand-new server, to the day one gets in anyway. Read them in order, or jump to what you need.

  1. 1What Is a ProcessEvery command on your server becomes a process with a PID, an owner and a parent. List the linux processes you own on Ubuntu and read each column.6 min
  2. 2Signals and Killing ProcessesYou do not close a program on a server, you signal it. Learn the linux kill signals, the polite TERM and the forceful KILL, and stop a stuck process cleanly.6 min
  3. 3Jobs, Foreground and BackgroundOne terminal can run more than one thing. Push a command into the background, list your linux background jobs, and bring one back with fg when you need it.7 min
  4. 4systemd Services ExplainedServer software runs as a service that starts on boot and restarts on failure. Meet systemd, the service manager on every Linux box, and read a live status.6 min
  5. 5Reading Logs With journalctlWhen a service misbehaves, its logs live in the journal, not a text file. Read one service with journalctl, follow the systemd logs live, and filter by time.6 min
  6. 6Enabling and Masking UnitsStarting a service and making it start on boot differ. Learn systemctl enable and disable, and how to mask a unit so it can never run, even by accident.6 min
  7. 7Scheduling With cronSome jobs run on a schedule, not on demand. Write your first crontab entry, read the five time fields, and schedule linux cron jobs on a live Ubuntu server.7 min
  8. 8systemd Timerssystemd has its own scheduler that does more than cron. Create systemd timers that trigger a service, list the next run time, and see when they beat cron.7 min
  9. 9Resource Limits: nice and ulimitOne heavy process should not starve the server. Lower a job's priority with linux nice, and read the per-shell caps that ulimit enforces on every process.8 min