Trace system calls of a process
Prints out all system calls a PID makes (crucial for deep debugging).
strace -p <pid>
Slows the traced process noticeably; be careful on busy production hosts.
11 commands from the cloud runbook. Fill in a placeholder once and every command uses it.
Prints out all system calls a PID makes (crucial for deep debugging).
strace -p <pid>
Slows the traced process noticeably; be careful on busy production hosts.
Shows all files, sockets, and connections opened by a PID.
lsof -p <pid>
Shows a live view of the hottest CPU functions in the system.
sudo perf top
Shows system performance statistics (CPU, memory, I/O) every 2 seconds.
vmstat 2 10
Shows CPU and disk I/O stats, refreshing every second.
iostat -xz 1
Groups and counts TCP connections by their state (ESTABLISHED, TIME_WAIT, etc.).
ss -tan | awk 'NR>1 {print $1}' | sort | uniq -c | sort -rn
Writes a core file and lets the process carry on; it pauses only while the dump is written. gcore ships with gdb.
sudo gcore -o core <pid>
Shows detailed timing of DNS, connect, TLS, and transfer phases.
curl -o /dev/null -s -w "DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTLS: %{time_appconnect}s\nTotal: %{time_total}s\n" https://example.com
Attaches a temporary debug container that shares the target container's processes; useful when the image has no shell.
kubectl debug -it <pod-name> -n <namespace> --image=busybox:1.36 --target=<container-name>
Lists files that were deleted but are still open. Their space is not freed until the process closes them, so a disk can be full while du looks fine.
sudo lsof +L1
Searches the kernel log for processes the OOM killer ended.
sudo journalctl -k | grep -iE 'out of memory|killed process'