kldstat(8)

kldstat8

Display status of dynamic kernel linker

Usage

kldstat [-h] [-q] [-v] [-d] [-i id] [-n filename]

kldstat [-q] [-d] [-m modname]

Overview

The kldstat utility displays the status of any files dynamically linked into the kernel.

The following options are available:

-d

Show the module specific data (as int, unsigned int and unsigned long)

-h

Display the size field in a human-readable form, using unit suffixes instead of hex values.

-i id

Display the status of only the file with this ID.

-m modname

Display the status of only the module with this modname.

-n filename

Display the status of only the file with this filename.

-q

Quietly check if file is loaded or compiled into the kernel.

-v

Be more verbose.

Exit status

The kldstat utility exits 0 on success, and >0 if an error occurs.

Examples

Show files dynamically linked into the kernel. Note the kernel itself is shown in the list. Refs shows the number of modules referenced by each file:

$ kldstat
Id Refs Address                Size Name
 1   38 0xffffffff80200000  2448f20 kernel
 2    3 0xffffffff82649000    b7bd8 linux.ko
 3    5 0xffffffff82701000     9698 linux_common.ko
 4    1 0xffffffff82b11000     1eae linsysfs.ko
 5    1 0xffffffff82b13000    f2af8 nvidia-modeset.ko
 6    1 0xffffffff82c06000  122b020 nvidia.ko
 7    1 0xffffffff83e32000     2668 intpm.ko
 8    1 0xffffffff83e35000      b50 smbus.ko
 9    1 0xffffffff83e36000     18a0 uhid.ko
10    1 0xffffffff83e38000     2928 ums.ko
11    1 0xffffffff83e3b000     1aa0 wmt.ko
12    1 0xffffffff83e3d000     cd70 snd_uaudio.ko

Show the verbose status of the linux file and show the size in a human readable fashion:

$ kldstat -h -v -n linux
Id Refs Address             Size Name
 2    3 0xffffffff82649000  735K linux.ko (/boot/kernel/linux.ko)
        Contains modules:
                 Id Name
                  2 linuxelf

Same as above using the id of the file:

$ kldstat -h -i 2 -v
Id Refs Address             Size Name
 2    3 0xffffffff82649000  735K linux.ko (/boot/kernel/linux.ko)
        Contains modules:
                 Id Name
                  2 linuxelf

Show the status of the linuxelf module obtained from the example above:

$ kldstat -v -m linuxelf
Id  Refs Name
  2    1 linuxelf

Show the module specific data for the g_raid module:

$ kldstat -d -m g_raid
Id  Refs Name data..(int, uint, ulong)
366    1 g_raid (0, 0, 0x0)

Check if the module fakefile is linked. Returns 0 if it is, 1 otherwise:

$ kldstat -q -n fakefile || echo file not linked
file not linked

Releases

77 releases since FreeBSD 3.0-RELEASE; the text changed 45 times.

  1. 3.0
  2. 3.1–3.2
  3. 3.3–3.5.1
  4. 4.0
  5. 4.1–4.2
  6. 4.3–4.11
  7. 5.0–5.4
  8. 5.5
  9. 6.0
  10. 6.1–6.2
  11. 6.3
  12. 6.4
  13. 7.0
  14. 7.1
  15. 7.2
  16. 7.3
  17. 7.4
  18. 8.0
  19. 8.1
  20. 8.2
  21. 8.3
  22. 8.4
  23. 9.0
  24. 9.1
  25. 9.2
  26. 9.3
  27. 10.0
  28. 10.1
  29. 10.2
  30. 10.3
  31. 10.4
  32. 11.0
  33. 11.1
  34. 11.2
  35. 11.3
  36. 11.4
  37. 12.0
  38. 12.1
  39. 12.2
  40. 12.3
  41. 12.4
  42. 13.0–13.2
  43. 13.3–13.4
  44. 13.5
  45. 14.0–14.2
  46. 14.3–16.0

-d since FreeBSD 10.4-RELEASE; -h since FreeBSD 11.0-RELEASE; -m since FreeBSD 5.5-RELEASE; -q since FreeBSD 6.0-RELEASE.

History

The kldstat utility first appeared in FreeBSD 3.0, replacing the lkm interface.

Authors

Doug Rabson ⟨[email protected]⟩

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.