1================ 2bpftool-link 3================ 4------------------------------------------------------------------------------- 5tool for inspection and simple manipulation of eBPF links 6------------------------------------------------------------------------------- 7 8:Manual section: 8 9 10SYNOPSIS 11======== 12 13 **bpftool** [*OPTIONS*] **link** *COMMAND* 14 15 *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-f** | **--bpffs** } } 16 17 *COMMANDS* := { **show** | **list** | **pin** | **help** } 18 19LINK COMMANDS 20============= 21 22| **bpftool** **link { show | list }** [*LINK*] 23| **bpftool** **link pin** *LINK* *FILE* 24| **bpftool** **link help** 25| 26| *LINK* := { **id** *LINK_ID* | **pinned** *FILE* } 27 28 29DESCRIPTION 30=========== 31 **bpftool link { show | list }** [*LINK*] 32 Show information about active links. If *LINK* is 33 specified show information only about given link, 34 otherwise list all links currently active on the system. 35 36 Output will start with link ID followed by link type and 37 zero or more named attributes, some of which depend on type 38 of link. 39 40 Since Linux 5.8 bpftool is able to discover information about 41 processes that hold open file descriptors (FDs) against BPF 42 links. On such kernels bpftool will automatically emit this 43 information as well. 44 45 **bpftool link pin** *LINK* *FILE* 46 Pin link *LINK* as *FILE*. 47 48 Note: *FILE* must be located in *bpffs* mount. It must not 49 contain a dot character ('.'), which is reserved for future 50 extensions of *bpffs*. 51 52 **bpftool link help** 53 Print short help message. 54 55OPTIONS 56======= 57 -h, --help 58 Print short generic help message (similar to **bpftool help**). 59 60 -V, --version 61 Print version number (similar to **bpftool version**). 62 63 -j, --json 64 Generate JSON output. For commands that cannot produce JSON, this 65 option has no effect. 66 67 -p, --pretty 68 Generate human-readable JSON output. Implies **-j**. 69 70 -f, --bpffs 71 When showing BPF links, show file names of pinned 72 links. 73 74 -n, --nomount 75 Do not automatically attempt to mount any virtual file system 76 (such as tracefs or BPF virtual file system) when necessary. 77 78 -d, --debug 79 Print all logs available, even debug-level information. This 80 includes logs from libbpf. 81 82EXAMPLES 83======== 84**# bpftool link show** 85 86:: 87 88 10: cgroup prog 25 89 cgroup_id 614 attach_type egress 90 pids test_progs(223) 91 92**# bpftool --json --pretty link show** 93 94:: 95 96 [{ 97 "type": "cgroup", 98 "prog_id": 25, 99 "cgroup_id": 614, 100 "attach_type": "egress", 101 "pids": [{ 102 "pid": 223, 103 "comm": "test_progs" 104 } 105 ] 106 } 107 ] 108 109| 110| **# bpftool link pin id 10 /sys/fs/bpf/link** 111| **# ls -l /sys/fs/bpf/** 112 113:: 114 115 -rw------- 1 root root 0 Apr 23 21:39 link 116 117 118SEE ALSO 119======== 120 **bpf**\ (2), 121 **bpf-helpers**\ (7), 122 **bpftool**\ (8), 123 **bpftool-btf**\ (8), 124 **bpftool-cgroup**\ (8), 125 **bpftool-feature**\ (8), 126 **bpftool-gen**\ (8), 127 **bpftool-iter**\ (8), 128 **bpftool-map**\ (8), 129 **bpftool-net**\ (8), 130 **bpftool-perf**\ (8), 131 **bpftool-prog**\ (8), 132 **bpftool-struct_ops**\ (8) 133