What it does
lsmod formats /proc/modules (it has no options): the module name, its size in memory, how many users it has, and which modules use it. A module with users cannot be unloaded until they are gone.
How to write it
lsmodExamples 10
$ run as a normal user# run as root (or with sudo)
1All loaded modules
lsmod | head Module Size Used by xfs 2654208 2 libcrc32c 12288 2 xfs,nf_tablesUsed by: count and module names.
2Is a module loaded?
lsmod | grep -w vfatNo output = not loaded.
3Network card driver
lsmod | grep -E 'virtio_net|e1000|ixgbe|mlx'Which NIC driver runs.
4Count modules
Number of loaded modules.
5Modules with users
lsmod | awk '$3 > 0'These cannot be removed at once.
6Same data from /proc
lsmod reads this file.
7Biggest modules
Memory use of drivers.
8Check a blocked module stays off (security)
Verify your blacklist.
9Find unusual modules (security)
lsmod | awk 'NR>1 {print $1}' | while read m; do modinfo -F filename $m >/dev/null 2>&1 || echo "no file: $m"; doneA loaded module without a file on disk can be a rootkit.
10Module details
Info for the first module in the list.
Nothing matches this filter.
Files
/proc/modules- The kernel list of loaded modules.
Exit codes
0 :: Done. 1 :: Error.