0

List kernels

by
Published Oct 17, 2025

Lists available Kernels. Due to the extensive list of available kernels, please keep [pagination](https://techdocs.akamai.com/linode-api/reference/pagination) controls in mind when managing responses to this operation. > --- - __CLI__. ``` linode-cli kernels list ``` [Learn more...](https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-the-linode-cli)

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * List kernels
7
 * Lists available Kernels.
8

9
Due to the extensive list of available kernels, please keep [pagination](https://techdocs.akamai.com/linode-api/reference/pagination) controls in mind when managing responses to this operation.
10

11

12
>
13

14
---
15

16

17
- __CLI__.
18

19
    ```
20
    linode-cli kernels list
21
    ```
22

23
    [Learn more...](https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-the-linode-cli)
24
 */
25
export async function main(
26
  auth: Linode,
27
  apiVersion: "v4" | "v4beta",
28
  page: string | undefined,
29
  page_size: string | undefined,
30
) {
31
  const url = new URL(`https://api.linode.com/${apiVersion}/linode/kernels`);
32
  for (const [k, v] of [
33
    ["page", page],
34
    ["page_size", page_size],
35
  ]) {
36
    if (v !== undefined && v !== "" && k !== undefined) {
37
      url.searchParams.append(k, v);
38
    }
39
  }
40
  const response = await fetch(url, {
41
    method: "GET",
42
    headers: {
43
      Authorization: "Bearer " + auth.token,
44
    },
45
    body: undefined,
46
  });
47
  if (!response.ok) {
48
    const text = await response.text();
49
    throw new Error(`${response.status} ${text}`);
50
  }
51
  return await response.json();
52
}
53