filelife(8)

πŸ“¦ version 0.36.1, in alpine 3.24, nixpkgs unstable, opensuse-leap 16.0

πŸŽ€ filelife(8) πŸŽ€

Okay bestie, the filelife manual page is giving main character energy, so let's go through it together ✨

✨ NAME ✨

filelife is a tool that traces the lifespan of short-lived files πŸ¦‹ It uses Linux eBPF/bcc, so it's giving low-level kernel vibes πŸ’…

πŸ’œ SYNOPSIS πŸ’œ

filelife [-h] [-p PID]

🌸 DESCRIPTION 🌸

Okay so this one traces files being created and deleted πŸ“ For every deletion, it tells you who deleted the file, how old the file was, and what its name was. The whole point is to catch short-lived files so you can debug stuff or do performance analysis πŸ”₯

It works by tracing the kernel vfs_create() and vfs_delete() functions 🧚 There might be more it touches too, so check the source if you're curious πŸ‘€ It uses dynamic tracing to do this, which means it will need updating if those functions ever change. Not me having to babysit it πŸ’€

This tool uses a Linux 4.4 feature called bpf_perf_event_output() ✨ If you're on a kernel older than 4.4, look in the version under tools/old. That one uses an older mechanism instead 🫢

Heads up: since this runs on BPF, only the root user can use this tool πŸ”

πŸŽ€ REQUIREMENTS πŸŽ€

You need CONFIG_BPF and bcc πŸ’–

✨ OPTIONS ✨

  • -h β€” Pulls up the usage message πŸ“
  • -p PID β€” Only traces this process ID, and the filtering happens in-kernel 🎯

πŸ“ EXAMPLES πŸ“

Trace all short-lived files and print the details:

# filelife

Trace all short-lived files created AND deleted by PID 181:

# filelife -p 181

πŸ¦‹ FIELDS πŸ¦‹

  • TIME β€” When the deletion happened ⏰
  • PID β€” The process ID that deleted the file πŸͺͺ
  • COMM β€” The process name for that PID 🏷️
  • AGE(s) β€” How old the file was, from creation to deletion, in seconds ⏳
  • FILE β€” The filename πŸ“„

🌈 OVERHEAD 🌈

This traces the kernel VFS file create and delete functions and prints output for each delete. The rate is usually expected to be low (< 1000/s), so the overhead should be negligible 😌 This is from bcc.

Check out the project here: https://github.com/iovisor/bcc

Also, look in the bcc distribution for a companion _examples.txt file. It has example usage, output, and commentary for this tool πŸ“š

πŸ’» OS πŸ’»

Linux only 🐧

πŸ§ͺ STABILITY πŸ§ͺ

Unstable - it's still in development 🚧

πŸ‘‘ AUTHOR πŸ‘‘

Brendan Gregg 🫢

πŸ”— SEE ALSO πŸ”—

  • opensnoop(1) πŸ‘€

Okay bestie, that's the whole filelife page πŸ’… It's the manual for the filelife tool, from the USER COMMANDS section, dated 2016-02-08 πŸŽ€ Go trace some short-lived files and slay the debugging game πŸ’–πŸŒΈ