Monday, August 16, 2010

Viewing Modules in Ubuntu

The basic command to see what modules are currently loaded is lsmod. Running lsmod displays the LKM’s common name, size of the LKM, and any other LKMs that depend on it. For example:

$ lsmod | head
Module Size Used by
floppy 64676 0
rfcomm 43604 0
l2cap 28192 5 rfcomm
bluetooth 54084 4 rfcomm,l2cap
ppdev 9668 0
speedstep_lib 4580 0
cpufreq_userspace 6496 0
cpufreq_stats 6688 0
freq_table 4928 1 cpufreq_stats

This shows that the bluetooth module is loaded and is in use by the rfcomm and l2cap modules. A second command, modprobe, can be used to show the actual LKM files.

$ modprobe -l bluetooth

The modprobe command can also list available modules-not just ones that are loaded. For example, to see all the asynchronous transfer mode (ATM) network drivers, you can use:

$ modprobe -l -t atm

The -t atm parameter shows all modules with the ATM tag. LKMs are stored in an organized directory, so the tag indicates the directory name. This is different from using modprobe -l '*atm*’, since that will only show modules containing ‘‘atm’’ in the LKM file name.

Along with modprobe, you can use modinfo to learn more about a particular LKM. The modinfo command lists information about a module, or it can be used to retrieve specific information. For example:

$ modinfo lp # list information about the lp module
filename: /lib/modules/2.6.31-15-generic/kernel/drivers/char/lp.ko
license: GPL
alias: char-major-6-*
srcversion: 84EA21D13BD2C67171AC994
depends: parport
vermagic: 2.6.31-15-generic SMP mod_unload modversions 586
parm: parport:array of charp
parm: reset:bool

If you only need to see a particular field from the modinfo output, then you can use the -F parameter with any of the listed fields. For example, -F filename only displays the file name for the module.

$ modinfo -F filename lp # only list the filename field

Source of Information : Wiley Ubuntu Powerful Hacks And Customizations

No comments: