bashreadline.bt(8)

πŸ“¦ version 0.17.0, in debian bookworm

πŸŽ€ NAME πŸŽ€

okay so bestie, meet bashreadline.bt β€” the manual page lives in section 8, and this little icon prints bash commands system wide. Uses bpftrace/eBPF, no big deal πŸ’…


✨ SYNOPSIS ✨

bashreadline.bt

that's it. that's the whole vibe. she takes no arguments, she just watches. πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so what she does is trace the return of the readline() function using uretprobes, and that's how she shows you the bash commands people entered interactively, system wide. like, every bash on the machine. the way she sees everything?? main character energy fr fr.

heads up though β€” the entered command may fail. this tool is just showing you what was entered, not whether it worked. no cap, don't read it as "this command succeeded", because that's not what's happening. 🫢

also she's a basic example of bpftrace and uretprobes, so if you're learning those, she's lowkey a great study buddy.

and because this uses BPF, only the root user can use this tool. periodt. πŸ™ˆ


🌈 REQUIREMENTS 🌈

  • CONFIG_BPF
  • bpftrace

that's the whole checklist, bestie. ✨


πŸ¦‹ EXAMPLES πŸ¦‹

trace bash commands system wide:

# bashreadline.bt

πŸ“ FIELDS πŸ“

  • TIME β€” a timestamp on the output, in "HH:MM:SS" format.
  • PID β€” the process ID for bash.
  • COMMAND β€” entered command.

🧚 OVERHEAD 🧚

ngl the overhead here is expected to be negligible β€” because the rate of interactive bash commands is expected to be very low (<<100/s). she's basically sipping her drink in the corner, not even breaking a sweat. πŸ’œ


πŸ‘‘ SOURCE πŸ‘‘

this is from bpftrace.

https://github.com/iovisor/bpftrace

also, go look in the bpftrace distribution for a companion _examples.txt file β€” it's got example usage, output, and commentary for this tool. very slay of them to include that. πŸ“š

and bestie, know this: she's a bpftrace version of the bcc tool of the same name. the bcc tool may provide more options and customizations, so if you want more knobs to turn, go check that one out:

https://github.com/iovisor/bcc

🐧 OS 🐧

Linux


πŸ’€ STABILITY πŸ’€

Unstable β€” in development.

so like… she's growing, she's evolving, she's in her development era. handle with care. 🫢


🌸 AUTHOR 🌸

Brendan Gregg


⭐ SEE ALSO ⭐


okay that's the whole page!! sending you the biggest virtual hug for reading all of it πŸ«ΆπŸ’– this was the USER COMMANDS version, dated 2018-09-06, and yes bestie, the page itself is literally named bashreadline.bt(8) β€” iconic from start to finish. now go trace some commands, you absolute legend. πŸ‘‘βœ¨

πŸ“¦ where this page comes from