bpftool
Inspect and manage eBPF programs and maps.
TLDR
SYNOPSIS
bpftool [object] command [options]
DESCRIPTION
bpftool inspects and manipulates eBPF (extended Berkeley Packet Filter) programs and maps. It provides visibility into loaded BPF programs, their attachments, and the data structures they use.eBPF is a powerful Linux kernel technology used for networking, security, tracing, and performance analysis. bpftool is essential for debugging and managing eBPF-based tools.
OPTIONS
-j, --json
Generate JSON output.-p, --pretty
Generate human-readable JSON output (implies -j).-d, --debug
Print libbpf debug messages to stderr.-f, --bpffs
When showing programs, show file names of pinned objects.-V, --version
Print version number and supported features.
OBJECTS
prog
Manage BPF programsmap
Manage BPF mapslink
Manage BPF linksnet
Inspect network-related BPF attachmentsperf
Inspect perf-related BPF attachmentsbtf
Manage BTF (BPF Type Format) datacgroup
Show, attach, and detach BPF programs on cgroupsfeature
Probe kernel/device for BPF feature supportgen
Generate skeleton C header files and BTF data from object filesstruct_ops
Register, unregister, and introspect BPF struct_opsiter
Create and pin BPF iterators
CAVEATS
Requires root privileges or CAP_BPF capability. Output format may vary between kernel versions. Some features require specific kernel configuration options.
HISTORY
bpftool is developed in the Linux kernel source tree under tools/bpf/bpftool and ships with the kernel. It is periodically synced to a stand-alone build mirror maintained by the libbpf project, which packages it independently of the full kernel tree.
