opensnoop.bt(8)
π opensnoop.bt β the tea β
okay bestie, so you know how this whole thing lives in section 8 of the System Manager's Manual? yeah. that's the vibe. let's get into it π«Ά
β¨ NAME β¨
opensnoop.bt β traces open() syscalls. and it does it with bpftrace/eBPF, which is lowkey iconic π
π¦ SYNOPSIS π¦
opensnoop.bt
that's it. no flags, no args, no drama. she's a one-liner. periodt.
πΈ DESCRIPTION πΈ
so opensnoop traces the open() syscall and shows you which processes are trying to open which files. genuinely so useful, no cap β it's giving "where tf is my config file" energy, and it's also the move when an app is failing and you need to troubleshoot it. especially at startup, when everything is chaos and nothing tells you why π
the way it works: it traces the open() syscall tracepoint. that's the whole trick.
β οΈ okay so because this uses BPF, only the root user can use this tool. no root, no sniffs. sorry babe π
π REQUIREMENTS π
CONFIG_BPFbcc
both. or nothing. π
π₯ EXAMPLES π₯
trace all the open() syscalls, every single one, unbothered, moisturized:
# opensnoop.bt
π FIELDS π
here's what every column is serving, bestie:
PIDβ Process IDTIDβ Thread IDCOMMβ Process nameFDβ File descriptor (if success), or-1(if failed)ERRβ Error number (see the system'serrno.h)PATHβ Open path
π OVERHEAD π
so this traces the open tracepoint and prints output for each event. the rate of these is generally expected to be low β like, < 1000/s low β so the overhead is also expected to be negligible. cute, right? π
π¬ but if you've got an application calling a high rate of open()s, then please test and understand the overhead before use. do not just yolo it. test first. i'm serious. fr fr.
π§ SOURCE π§
this is from bpftrace π
also β look in the bpftrace distribution for a companion _examples.txt file, because it's got example usage, output, and commentary for this tool. very much worth the read, iykyk β¨
and! this is a bpftrace version of the bcc tool of the same name. the bcc tool may provide more options and customizations, so if you want the deluxe edition:
π OS π
Linux π§ (obviously)
π STABILITY π
Unstable - in development.
she's still growing, okay. be nice to her π
β AUTHOR β
Brendan Gregg π
π SEE ALSO π
and that's the whole page, bestie!! this one came from the USER COMMANDS corner of the manual, dated 2018-09-08 β so yeah, a lil vintage, but she still slays. go trace something. responsibly. with root. π
β¨
π¦ 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