killsnoop(8)
β¨ killsnoop(8) β¨
okay bestie, welcome to killsnoop from the System Manager's Manual β she traces kill() syscalls and gives you the process AND signal deets, using Linux ftrace. it's giving detective energy fr fr ππ
πΈ SYNOPSIS πΈ
killsnoop [-hst] [-d secs] [-p pid] [-n name]
π DESCRIPTION π
so basically, this traces kill() syscalls. it shows you which process killed which pid, and it hands you the returncode too β that's 0 for success, -1 for error. slay.
this implementation was built to work on older kernel versions and without kernel debuginfo. the way it does it: dynamic tracing of the return value of kill(), then associating that with the previous kill() syscall return. ngl, this approach is kernel version specific and may not work on your version π. it's a workaround, and a proof of concept for ftrace, until more kernel tracing functionality is available. periodt.
since this uses ftrace, only the root user can use this tool. no root, no vibes. π
π REQUIREMENTS π
- FTRACE and KPROBE CONFIG
- the kernel tracepoints
syscalls:sys_enter_killandsyscalls:sys_exit_kill(you may already have these on recent kernels, lucky you β¨) - and
awk
π OPTIONS π
-d secsβ set how long you wanna trace, in seconds. trace output gets buffered and printed at the end. this also reduces overheads by buffering in-kernel instead of printing events as they occur. iconic efficiency behavior.
the ftrace buffer has a fixed size per-CPU (see /sys/kernel/debug/tracing/buffer_size_kb). if you think events are missing, try increasing that size. don't let the buffer ghost you π»
-hβ print the usage message. that's it, that's the whole job π«Ά-n nameβ only show processes matching this process name. partial strings and regular expressions are allowed. this one is post-filtered usingawk.-p PIDβ only trace this process ID. this is filtered in-kernel (fancy!).-sβ use human readable signal names instead of signal numbers. becauseSIGKILLjust hits different than9π-tβ include timestamps, in seconds. β°
π EXAMPLES π
trace all kill() syscalls with details:
# killsnoop
trace kill() syscalls with readable signal names, and times:
# killsnoop -st
track kill() syscalls for processes named "httpd":
# killsnoop -n httpd
π¦ FIELDS π¦
TIMEsβ time ofopen()completion, in units of seconds.COMMβ process name (if known) of the process that issued the signal.PIDβ process ID that issued the signal.TPIDβ target PID for the signal.SIGNALβ signal number sent to the target process, or name if-sis used.RETURNβ return status:0for success,-1for failure.
π₯ OVERHEAD π₯
this reads kill() syscalls as they occur. for high rates of kills (> 500/s), the overhead may begin to be measurable β however, the rate is unlikely to get this high. and if it is: you should investigate why π. test yourself. you can also use the -d mode to buffer output, reducing overheads.
β SOURCE β
this is from the perf-tools collection.
https://github.com/brendangregg/perf-tools
also look under the examples directory for a text file containing example usage, output, and commentary for this tool. iykyk π
π OS π
Linux π§
π STABILITY π
Unstable - in development. (she's growing, okay?! main character development arc β¨)
πΈ AUTHOR πΈ
Martin Probst
π«Ά SEE ALSO π«Ά
tpoint(8), execsnoop(8), opensnoop(8)
okay that's the whole page bestie, no cap π this one's from USER COMMANDS, dated 2014-09-15, and it's the killsnoop(8) era β go forth and trace those signals, you absolute icon π¦β¨
π¦ where this page comes from
- debian bookworm: perf-tools-unstable 1.0.1~20200130+git49b8cdf-1 Β· GPL-2.0-or-later
- debian trixie: perf-tools-unstable 1.0.1~20200130+git49b8cdf-1 Β· GPL-2.0-or-later
- ubuntu jammy: perf-tools-unstable 1.0.1~20200130+git49b8cdf-1ubuntu1 Β· GPL-2.0-or-later
- ubuntu noble: perf-tools-unstable 1.0.1~20200130+git49b8cdf-1ubuntu1 Β· GPL-2.0-or-later
- ubuntu resolute: perf-tools-unstable 1.0.1~20200130+git49b8cdf-1ubuntu2 Β· GPL-2.0-or-later
- ubuntu stonking: perf-tools-unstable 1.0.1~20200130+git49b8cdf-1ubuntu2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms