execsnoop.bt(8)
π execsnoop.bt β bestie's guide to watching new processes be born π
okay so this is the execsnoop.bt page from section 8 of the System Manager's Manual, and it's literally about tracing brand-new processes through exec() syscalls using bpftrace/eBPF. sit down, grab a strawberry π, we're doing kernel things.
β¨ NAME β¨
execsnoop.bt β trace new processes via exec() syscalls. uses bpftrace/eBPF. no cap. π
β¨ SYNOPSIS β¨
execsnoop.bt
that's it bestie. no flags, no arguments, just vibes and root privileges.
β¨ DESCRIPTION β¨
so what this does is it traces when processes call exec() β that's execve() if we're being precise, and we ARE π
. it's handy for identifying new processes created via the usual fork()->exec() sequence. the classic combo, the main character arc of process creation, periodt.
β οΈ lowkey important: the return value is not currently traced, so the exec() may have failed. so like, don't come for this tool when it shows you a process that didn't actually make it. it's giving "saw the attempt," not "saw the outcome." π
this tool is useful for debugging shell scripts, including application startup. like when your script is doing Something and you're just staring at it like ποΈπποΈ β this shows you what's actually exec'ing.
it's ALSO useful for identifying a type of performance issue: a flood of short-lived processes, that end quickly and aren't readily visible in top(1). you know the ones. they blink in and out of existence so fast that top(1) is like "who? never met her." those little ghost processes. this catches them. π¦
π₯ real talk: since this uses BPF, only the root user can use this tool. that's not a vibe check you can skip, bestie.
β¨ REQUIREMENTS β¨
CONFIG_BPFbpftrace
both or it's a no. π«Ά
β¨ EXAMPLES β¨
trace ALL new processes calling execve():
# execsnoop.bt
that's the whole thing. that's the example. iconic behavior honestly. β¨
β¨ FIELDS β¨
here's what you're looking at in the output, one by one:
TIMEβ time of theexec()call, in milliseconds since program start. so like, milliseconds since the program started, not wall clock. important distinction, iykyk.PIDβ process ID. the whole point. πARGSβ process name and arguments. and heads up, it's a 16 word maximum. so if your command line is a whole novel, you're getting the first 16 words and that's the tea. π
β¨ OVERHEAD β¨
okay so this traces the execve() tracepoint and prints output for each event. every single one. and as the rate of this is generally expected to be low (< 100/s), the overhead is also expected to be negligible. slay, we love a cheap trace. π
BUT. if you have an application that is spawning a high rate of new processes for a reason β large build process energy β this could cause a small amount of overhead.
π«Ά friendly reminder from the manpage itself: test and understand overhead before use. don't just yolo it on prod, bestie, i'm begging.
β¨ SOURCE β¨
this is from bpftrace.
https://github.com/iovisor/bpftrace
also, look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. it's got the lore. π
this is a bpftrace version of the bcc</bcc> tool of the same name. and fun fact: the bcc tool provides more fields and options to customize the output. so if you want the deluxe edition, that's where it's at.
https://github.com/iovisor/bcc
β¨ OS β¨
Linux π (obviously, it's eBPF, where else would it be)
β¨ STABILITY β¨
π Unstable - in development.
it's giving "we're still cooking." use accordingly. π
β¨ AUTHOR β¨
Brendan Gregg π
β¨ SEE ALSO β¨
opensnoop.bt(8)β the sibling. the bestie of this tool. go read it too. π¦
and that's the whole page, you're fully caught up β¨ this was a USER COMMANDS entry from 2018-09-11, brought to you by your local eBPF girlie β go trace something, you got this πππ
π¦ where this page comes from
- debian bookworm: bpftrace 0.17.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms