Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.


CompTIA Linux+ XK0-005 - 1.7 - Configure Kernel Options: lsmod

Configuring kernel modules is an essential part of managing a Linux system. Kernel modules are dynamically loadable components that extend the functionality of the Linux kernel. In this guide, we will explore how to work with kernel modules using the lsmod command.

Working with lsmod

The lsmod command allows you to list currently loaded kernel modules on your Linux system. It provides information about the modules, such as their names, sizes, and usage count. Here's how you can work with the lsmod command:

  1. Open a terminal on your Linux system.

  2. To list the currently loaded kernel modules, use the following command:

    lsmod
    

    Example output:

    Module                  Size  Used by
    iptable_filter         16384  0
    xt_conntrack           16384  1
    nf_conntrack          167936  1 xt_conntrack
    nf_defrag_ipv6         24576  1 nf_conntrack
    nf_defrag_ipv4         16384  1 nf_conntrack
    

    This command displays a table with information about each loaded module, including its name, size, and usage count.

  3. To filter the output and display specific modules and what other modules are using them, you can use tools like grep or awk. For example, to display only the modules related to nf_conntrack, you can run the following command:

    lsmod | grep 'nf_conntrack'
    

    Example output:

    nf_conntrack          167936  1 xt_conntrack
    nf_defrag_ipv6         24576  1 nf_conntrack
    nf_defrag_ipv4         16384  1 nf_conntrack
    

    This command filters the lsmod output to show all rows containing "nf_conntrack".

Conclusion

Working with kernel modules using the lsmod command allows you to list and inspect the currently loaded modules on your Linux system. This information can be valuable for troubleshooting, understanding system dependencies, and managing module configurations.

The lsmod command provides a convenient way to view the list of loaded kernel modules and their associated details. You can use tools like grep or awk to filter the output and display specific modules based on your requirements.


Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.