ttysnoop(8)
π ttysnoop(8) π
β¨ NAME β¨
okay so ttysnoop is the tool that lets you watch whatever output is showing up on a tty or pts device π It's built on Linux eBPF/bcc, so it's giving kernel-level main character energy π
πΈ SYNOPSIS πΈ
ttysnoop [-h] [-C] device
π DESCRIPTION π
okay so bestie, ttysnoop watches a tty or pts device and prints the exact same output that's appearing on that device β¨ It's perfect for mirroring a shell session or the system console π¦
Lowkey the way it works is through kernel dynamic tracing of the tty_write() function π§ Heads up though: if that kernel function ever changes in a future kernel version, this tool will need updating π
β οΈ Since this uses BPF, only the root user can run this tool. No cap, nobody else gets in π₯
π REQUIREMENTS π
You'll need CONFIG_BPF and bcc π«Ά
π OPTIONS π
-Cβ don't clear the screen π§Ή (the screen stays as-is, slay)-s SIZE,--datasize SIZEβ the size of the transmitting buffer. It defaults to256π-c COUNT,--datacount COUNTβ how many timesttysnopchecks for SIZE bytes of data. It defaults to16β- device β either a path to a tty device (like
/dev/tty0) or a pts number (like the3from/dev/pts/3) π
π¦ EXAMPLES π¦
Snoop output from /dev/pts/2 πΈ
# ttysnoop /dev/pts/2
Snoop output from /dev/pts/2, but the shortcut version π
# ttysnoop 2
Snoop output from the system console π₯οΈ
# ttysnoop /dev/console
Snoop output from /dev/tty0 π
# ttysnoop /dev/tty0
π§ OVERHEAD π§
The rate of tty_write() is expected to be very low (<100/s), so the overhead of this tool is expected to be negligible π₯Ή literally barely there.
π«Ά SOURCE π«Ά
This is from bcc π
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, so it's a must-read πβ¨
π OS π
Linux π§
π STABILITY π
Unstable, still in development π§ it's giving work-in-progress.
π AUTHOR π
Brendan Gregg π
π₯ SEE ALSO π₯
opensnoop(1) β¨
Bye bestie, go be iconic with your snooping π¦π (Source: USER COMMANDS, dated 2016-02-08, ttysnoop(8) π)
π¦ where this page comes from
- centos-stream 10: bcc-tools 0.36.1-1.el10 Β· Apache-2.0
- centos-stream 9: bcc-tools 0.36.1-1.el9 Β· ASL 2.0
- fedora 43: bcc-tools 0.35.0-2.fc43 Β· Apache-2.0
- fedora 44: bcc-tools 0.35.0-5.fc44 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms