Processes and systemd: ps, top, systemctl
Watching processes, signals, background jobs and managing services.
Level 201 · 18 lessons · 15 practice labs
Lessons
Processes
- Listing processes: ps and PIDs: You will use ps to list running processes and their IDs (PIDs), read who owns each one, and notice a process you did not expect.
- Live monitoring with top: You will use top to watch processes live, sort by CPU and memory use, and read the table correctly.
- Signals: kill, pkill, SIGTERM and SIGKILL: You will learn to send signals to processes, the difference between stopping politely with SIGTERM and forcibly with SIGKILL, and when to choose each.
- Foreground, background and job control: You will learn to run a command in the foreground, in the background or paused, and to manage jobs in your shell.
- Priority: nice and renice: You will use nice and renice to change process priority and stop a heavy job from slowing down everything else.
- Surviving a closed session: nohup, tmux and screen: With nohup, tmux and screen you can keep a long job running after a disconnect and resume it from another terminal.
- Diagnosing a runaway process: You will learn to track down a runaway process that is eating CPU or memory, investigate the cause, and stop it without harming the system.
- Short task: find the parent of the zombie processes and clean up
Services
- Managing services with systemctl: You will use systemctl to check a service's status, start and stop it, and read the first clues about why a service is not running.
- Enable at boot, and reload versus restart: You will learn to start a service automatically at boot, and the difference between reload and restart, so you can choose without causing needless downtime.
- Service logs with journalctl: You will use journalctl to filter a service's logs, look at a specific time window, and find error messages.
- Writing your own systemd service unit: You will define a script as a systemd service, start it at boot and have it restart automatically after a crash.
- Service dependencies: After, Requires and Wants
- systemd timers: an alternative to cron: You will write a service and timer unit to run a job at set intervals and follow the result with journalctl.
- Short task: run a small app as a service that restarts when it crashes
Resources and wrap-up
- Reporting system resources: memory, disk, CPU: You will learn to gather memory, disk and CPU usage into a short, readable system status report.
- Looking inside a process with /proc: cmdline, environ and fd
- Capstone: rescue a broken service: On a fictional company's lab server you will find the cause of a failing service from its logs, repair it, and document what you did in a short note.
Practice labs
- Find the process listening on a port and its owner: Find the PID, owner and full command line of the process listening on port 8080 and submit them.
- Find the responsible parent in the process tree: Use a tree view to find the parent of worker processes that keep respawning and determine which service owns it.
- Examine a suspicious process through /proc: For a process named like a system service, extract its real binary, working directory, environment and open files from /proc and report.
- Stop a process cleanly with the right signal: Stop a process in the middle of writing without data loss and confirm it cleaned up its temporary file on exit.
- Find the source of zombie processes and clear them: Find the parent of zombies piling up in the process table, clear them the right way and show they do not return.
- Run a batch job without slowing interactive sessions: Start a long report job with low CPU and I/O priority so it survives logout, and change its priority while it runs.
- Read why services failed from their status: List the failed units and write down the exit code and last error line of each.
- Enable a service at boot and reload it without an outage: Enable a hand-started service at boot, apply a config change without restarting and show the PID did not change.
- Solve a mask and conflict keeping a service down: Bring up a unit that is masked and clashes with another service on the same port, and verify the fix holds after a reboot.
- Run a script as a systemd service: Write a service unit for a small script, enable it and show its output in the journal.
- Restart a crashing app automatically: Add a restart rule and delay to the unit of an app that crashes now and then, with a limit against endless loops.
- Build a scheduled service with a dependency: Write an hourly report service with its timer that runs only when the database is up and the network is ready, and verify the ordering.
- Report the processes using the most memory: Read available memory from the right column and list the five processes consuming the most.
- Diagnose a runaway process: Determine which service a CPU-hogging process belongs to, how long it has run and what it is doing, then stop the service cleanly.
- Rescue a broken service end to end: On Ayçiçeği Gıda's order service find from the journal and fix three faults: a file permission, a missing directory and a bad unit line.
About this course
Watching processes, signals, background jobs and managing services.
What you will learn
- Processes
- Services
- Resources and wrap-up
Prerequisites
Finishing the level 101 courses of the same path, or knowing those topics, is enough.
Lab environment
Lessons run in your own Kali Linux terminal that opens in the browser. Nothing to install; the lab starts clean in every lesson.
Frequently asked questions
- Is this course right for my level?
- The course is at level 201; it assumes you know the topics of the lower-level courses.
- Is there anything to install?
- No. Every lesson runs in your own lab environment that opens in the browser.
- How do lessons work?
- Each lesson has 8 to 10 steps and a short quiz. Early steps show the command to type, later steps give less help; if two attempts fail, the solution opens.
- Can I try it for free?
- Yes. The first three lessons of every course are free.