bashreadline-bpfcc8
Print entered bash commands system wide. uses linux ebpf/bcc.
Usage
bashreadline [-h]
[-s
SHARED]
Overview
bashreadline traces the return of the readline() function using uprobes, to show the bash commands that were entered interactively, system wide. The entered command may fail: this is just showing what was entered.
This program is also a basic example of eBPF/bcc and uprobes.
This makes use of a Linux 4.4 feature (bpf_perf_event_output()); for kernels older than 4.4, see the version under tools/old, which uses an older mechanism
Since this uses BPF, only the root user can use this tool.
Requirements
CONFIG_BPF and bcc.
Options
-
-h -
Print usage message.
-
-s -
Specify the location of libreadline.so shared library when you failed to run the script directly with error: "Exception: could not determine address of symbol ´readline´". Default value is /lib/libreadline.so.
Examples
- Trace bash commands system wide:
-
#
bashreadline
Fields
- TIME
-
Time of the command (HH:MM:SS).
- PID
-
Process ID of the bash shell.
- COMMAND
-
Entered command.
Overhead
As the rate of interactive bash commands is expected to be very low (<<100/s), the overhead of this program is expected to be negligible.
Source
This is from bcc.
-
https://github.com/iovisor/bcc
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool.
OS
Linux
Stability
Unstable - in development.
History
- Debian 13 (Trixie) to Debian 11 (Bullseye): the text shown here
- Debian 10 (Buster)
-h since Debian 11 (Bullseye);
-s since Debian 11 (Bullseye).