Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
Seeing files opened by a process using opensnoop#
I decided to try out atuin, a shell extension that writes your history to a SQLite database.
It’s really neat. I wanted to see where the SQLite database lived on disk so I could poke around inside it with Datasette.
The documentation didn’t mention the location of the database file, so I decided to figure that out myself.
I worked out a recipe using opensnoop, which comes pre-installed on macOS.
In one terminal window, run this:
1sudo opensnoop 2>/dev/null | grep atuinThen run the atuin history command in another terminal - and the files that it accesses will be dumped out by opensnoop:
1 501 51725 atuin 4 /dev/dtracehelper2 501 51725 atuin -1 /etc/.mdns_debug3 501 51725 atuin 4 /usr/local/Cellar/atuin/0.9.1/bin4 501 51725 atuin -1 /usr/local/Cellar/atuin/0.9.1/bin/Info.plist5 501 51725 atuin 4 /dev/autofs_nowait6 501 51725 atuin 5 /Users/simon/.CFUserTextEncoding7 501 51725 atuin 4 /dev/autofs_nowait8 501 51725 atuin 5 /Users/simon/.CFUserTextEncoding9 501 51725 atuin 10 .10 501 51725 atuin 10 /Users/simon/.config/atuin/config.toml11 501 51725 atuin 10 /Users/simon/.local/share/atuin/history.db12 501 51725 atuin 11 /Users/simon/.local/share/atuin/history.db-wal13 501 51725 atuin 12 /Users/simon/.local/share/atuin/history.db-shmThen I ran open /Users/simon/.local/share/atuin/history.db (because I have Datasette Desktop installed) and could start exploring that database:

The 2>/dev/null bit redirects standard error for opensnoop to /dev/null - without this it spews out a noisy volume of dtrace: error ... warnings.
Alternative solutions#
My Twitter thread asking about this resulted in a bunch of leads that I’ve not fully investigated yet, including:
- FileMonitor
- FSMonitor
iosnoopfs_usagesudo dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0)); }'strace(Linux, not macOS)