.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "BPFTOOL-LINK" 8 "" "" .SH NAME bpftool-link \- tool for inspection and simple manipulation of eBPF links .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 \fBbpftool\fP [\fIOPTIONS\fP] \fBlink\fP \fICOMMAND\fP .sp \fIOPTIONS\fP := { { \fB\-j\fP | \fB\-\-json\fP } [{ \fB\-p\fP | \fB\-\-pretty\fP }] | { \fB\-d\fP | \fB\-\-debug\fP } | { \fB\-f\fP | \fB\-\-bpffs\fP } | { \fB\-n\fP | \fB\-\-nomount\fP } } .sp \fICOMMANDS\fP := { \fBshow\fP | \fBlist\fP | \fBpin\fP | \fBhelp\fP } .UNINDENT .UNINDENT .SH LINK COMMANDS .nf \fBbpftool\fP \fBlink { show | list }\fP [\fILINK\fP] \fBbpftool\fP \fBlink pin\fP \fILINK\fP \fIFILE\fP \fBbpftool\fP \fBlink detach\fP \fILINK\fP \fBbpftool\fP \fBlink help\fP \fILINK\fP := { \fBid\fP \fILINK_ID\fP | \fBpinned\fP \fIFILE\fP } .fi .sp .SH DESCRIPTION .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBbpftool link { show | list }\fP [\fILINK\fP] Show information about active links. If \fILINK\fP is specified show information only about given link, otherwise list all links currently active on the system. .sp Output will start with link ID followed by link type and zero or more named attributes, some of which depend on type of link. .sp Since Linux 5.8 bpftool is able to discover information about processes that hold open file descriptors (FDs) against BPF links. On such kernels bpftool will automatically emit this information as well. .TP .B \fBbpftool link pin\fP \fILINK\fP \fIFILE\fP Pin link \fILINK\fP as \fIFILE\fP\&. .sp Note: \fIFILE\fP must be located in \fIbpffs\fP mount. It must not contain a dot character (\(aq.\(aq), which is reserved for future extensions of \fIbpffs\fP\&. .TP .B \fBbpftool link detach\fP \fILINK\fP Force\-detach link \fILINK\fP\&. BPF link and its underlying BPF program will stay valid, but they will be detached from the respective BPF hook and BPF link will transition into a defunct state until last open file descriptor for that link is closed. .TP .B \fBbpftool link help\fP Print short help message. .UNINDENT .UNINDENT .UNINDENT .SH OPTIONS .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \-h\fP,\fB \-\-help Print short help message (similar to \fBbpftool help\fP). .TP .B \-V\fP,\fB \-\-version Print bpftool\(aqs version number (similar to \fBbpftool version\fP), the number of the libbpf version in use, and optional features that were included when bpftool was compiled. Optional features include linking against LLVM or libbfd to provide the disassembler for JIT\-ted programs (\fBbpftool prog dump jited\fP) and usage of BPF skeletons (some features like \fBbpftool prog profile\fP or showing pids associated to BPF objects may rely on it). .TP .B \-j\fP,\fB \-\-json Generate JSON output. For commands that cannot produce JSON, this option has no effect. .TP .B \-p\fP,\fB \-\-pretty Generate human\-readable JSON output. Implies \fB\-j\fP\&. .TP .B \-d\fP,\fB \-\-debug Print all logs available, even debug\-level information. This includes logs from libbpf as well as from the verifier, when attempting to load programs. .UNINDENT .INDENT 0.0 .TP .B \-f\fP,\fB \-\-bpffs When showing BPF links, show file names of pinned links. .TP .B \-n\fP,\fB \-\-nomount Do not automatically attempt to mount any virtual file system (such as tracefs or BPF virtual file system) when necessary. .UNINDENT .UNINDENT .UNINDENT .SH EXAMPLES .sp \fB# bpftool link show\fP .INDENT 0.0 .INDENT 3.5 .sp .EX 10: cgroup prog 25 cgroup_id 614 attach_type egress pids test_progs(223) .EE .UNINDENT .UNINDENT .sp \fB# bpftool \-\-json \-\-pretty link show\fP .INDENT 0.0 .INDENT 3.5 .sp .EX [{ \(dqtype\(dq: \(dqcgroup\(dq, \(dqprog_id\(dq: 25, \(dqcgroup_id\(dq: 614, \(dqattach_type\(dq: \(dqegress\(dq, \(dqpids\(dq: [{ \(dqpid\(dq: 223, \(dqcomm\(dq: \(dqtest_progs\(dq } ] } ] .EE .UNINDENT .UNINDENT .nf \fB# bpftool link pin id 10 /sys/fs/bpf/link\fP \fB# ls \-l /sys/fs/bpf/\fP .fi .sp .INDENT 0.0 .INDENT 3.5 .sp .EX \-rw\-\-\-\-\-\-\- 1 root root 0 Apr 23 21:39 link .EE .UNINDENT .UNINDENT .SH SEE ALSO .INDENT 0.0 .INDENT 3.5 \fBbpf\fP(2), \fBbpf\-helpers\fP(7), \fBbpftool\fP(8), \fBbpftool\-btf\fP(8), \fBbpftool\-cgroup\fP(8), \fBbpftool\-feature\fP(8), \fBbpftool\-gen\fP(8), \fBbpftool\-iter\fP(8), \fBbpftool\-map\fP(8), \fBbpftool\-net\fP(8), \fBbpftool\-perf\fP(8), \fBbpftool\-prog\fP(8), \fBbpftool\-struct_ops\fP(8) .UNINDENT .UNINDENT .\" Generated by docutils manpage writer. .