Lion Cipher Lab

See exactly what a program does with strace

Why it matters

Every interesting thing a program does, it does by asking the kernel. Touch a file, send a packet, spawn a child, read the clock, allocate memory from the OS — each is a SYSTEM CALL, a controlled jump from the program's own code (user space) into the kernel, which is the only code allowed to touch hardware and other processes. That boundary is the one place where a program's private intentions become observable actions, and strace lets you sit exactly on it and watch every crossing live. This is why strace is three tools at once. It is the debugger of last resort: when a program fails with a…

What you'll learn

Steps in this lab

  1. The one idea: a program only touches the world through system calls
  2. Get a Linux shell and install strace
  3. strace ls — watch a program open, read and write
  4. strace -f — follow the children a program spawns
  5. Prove a program hit the network: strace -e trace=network curl
  6. Every file it opens: the 'why can't it find its config' debugging superpower
  7. strace -c — profile it: which syscalls dominate?
  8. Attach to something already running: strace -p PID
  9. The judgment: when strace is the right tool, and when it lies to you
  10. macOS, Windows, and what you actually learned

Open the full interactive lab →