Back to the learning path

strace

strace = system call trace Command details
Step 1/1: Trace system calls

Opening files, reading, writing and networking all go through system calls to the kernel. strace COMMAND shows every one and its result (on standard error). -e trace=openat shows only file opens, -c counts them at the end, -p PID traces a running process.

$ strace -e trace=openat cat notes.txt
Fundamentalsstrace
See which files a command opens
Run wc -l notes.txt under strace, showing only the system calls that open files (openat): what does it open besides notes.txt?

This exercise needs real Linux

The commands it uses (processes, networking and more) are not in the simulator. Switch to real Linux and the exercise runs in a real Linux system inside your browser.

vmstatNext lesson:ping