| name | terminal-debugging |
| description | Debug processes with strace, ltrace, gdb, and /proc inspection. Use when tracing syscalls, debugging a hanging process, inspecting /proc for fd leaks, or attaching gdb to a running process. Do not use for app-level logging (prefer observability tools) or network capture (tcpdump/wireshark). |
| license | Apache-2.0 |
| compatibility | {"clients":["openai-codex","gemini-cli","opencode","github-copilot"]} |
| metadata | {"owner":"codex","domain":"terminal-debugging","maturity":"draft","risk":"low","tags":["debugging","strace","gdb","terminal"]} |
Purpose
Debug running processes from the terminal using strace, ltrace, gdb, and /proc filesystem inspection.
When to use this skill
- tracing syscalls to find why a process hangs or crashes
- inspecting file descriptor leaks via
/proc/<pid>/fd
- attaching
gdb to a running process for breakpoint debugging
- profiling dynamic library calls with
ltrace
Do not use this skill when
- debugging application logic with IDE debuggers or print statements
- capturing network traffic — use
tcpdump or wireshark
- the issue is a shell scripting bug — prefer
bash
Procedure
- Find process —
pgrep -a <name> or ps aux | grep <name> to get PID.
- Trace syscalls —
strace -p <pid> -e trace=open,read,write -f -t.
- Trace from start —
strace -f -o /tmp/trace.log ./myapp with child processes.
- Check open files —
ls -la /proc/<pid>/fd; lsof -p <pid> for details.
- Inspect memory —
cat /proc/<pid>/maps; grep VmRSS /proc/<pid>/status.
- Attach GDB —
gdb -p <pid>, then bt, info threads, continue.
- Library calls —
ltrace -p <pid> -e malloc+free to track allocations.
- Signals —
grep Sig /proc/<pid>/status for pending/blocked/ignored.
Common patterns
strace -p $(pgrep myapp) -e trace=network,file -f -t 2>&1 | head -100
ls /proc/$(pgrep myapp)/fd | wc -l
perf record -g -p $(pgrep myapp) -- sleep 30
perf report --stdio | head -50
coredumpctl list
coredumpctl gdb <pid>
Decision rules
strace -f to follow child processes — many issues are in forked workers.
- Filter with
-e trace=file,network,process,signal to reduce noise.
strace -c for syscall summary statistics instead of full trace.
ulimit -c unlimited before running to enable core dumps.
gdb -batch -ex bt -p <pid> for non-interactive backtrace in scripts.
References
Related skills
linux-ubuntu-ops — system-level diagnostics
bash — scripting debug workflows
ssh-tmux-remote-workflow — debugging on remote servers