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	**bpftool link pin** *LINK* *FILE*
41		  Pin link *LINK* as *FILE*.
42
43		  Note: *FILE* must be located in *bpffs* mount. It must not
44		  contain a dot character ('.'), which is reserved for future
45		  extensions of *bpffs*.
46
47	**bpftool link help**
48		  Print short help message.
49
50OPTIONS
51=======
52	-h, --help
53		  Print short generic help message (similar to **bpftool help**).
54
55	-V, --version
56		  Print version number (similar to **bpftool version**).
57
58	-j, --json
59		  Generate JSON output. For commands that cannot produce JSON, this
60		  option has no effect.
61
62	-p, --pretty
63		  Generate human-readable JSON output. Implies **-j**.
64
65	-f, --bpffs
66		  When showing BPF links, show file names of pinned
67		  links.
68
69	-n, --nomount
70		  Do not automatically attempt to mount any virtual file system
71		  (such as tracefs or BPF virtual file system) when necessary.
72
73	-d, --debug
74		  Print all logs available, even debug-level information. This
75		  includes logs from libbpf.
76
77EXAMPLES
78========
79**# bpftool link show**
80
81::
82
83    10: cgroup  prog 25
84            cgroup_id 614  attach_type egress
85
86**# bpftool --json --pretty link show**
87
88::
89
90    [{
91            "type": "cgroup",
92            "prog_id": 25,
93            "cgroup_id": 614,
94            "attach_type": "egress"
95        }
96    ]
97
98|
99| **# bpftool link pin id 10 /sys/fs/bpf/link**
100| **# ls -l /sys/fs/bpf/**
101
102::
103
104    -rw------- 1 root root 0 Apr 23 21:39 link
105
106
107SEE ALSO
108========
109	**bpf**\ (2),
110	**bpf-helpers**\ (7),
111	**bpftool**\ (8),
112	**bpftool-btf**\ (8),
113	**bpftool-cgroup**\ (8),
114	**bpftool-feature**\ (8),
115	**bpftool-gen**\ (8),
116	**bpftool-iter**\ (8),
117	**bpftool-map**\ (8),
118	**bpftool-net**\ (8),
119	**bpftool-perf**\ (8),
120	**bpftool-prog**\ (8),
121	**bpftool-struct_ops**\ (8)
122